schmittjoh / JMSI18nRoutingBundle

Allows you to internationalize your routing
http://jmsyst.com/bundles/JMSI18nRoutingBundle
358 stars 159 forks source link

Set headers to disble cache on redirect response #175

Closed mbohal closed 8 years ago

mbohal commented 8 years ago

When I get redirected to a detected language I do not want the response to be cached. The present state correctly redirects for the first user, but the other users get the cached response.

acasademont commented 8 years ago

Does not make sense to me. Symfony alreadyd puts a "Cache-Control: no-cache" header if no specific "caching" headers are set.

mbohal commented 8 years ago

I disagree. The Symfony Reverse Proxy Cache caches the redirects. Im using Symfony 2.7 with the prefix startegy.

How to reproduce:

  1. Enable reverse proxy
  2. Delete browser cookies
  3. Delete Symfony cache
  4. Go to http://localhost (or whereever the site runs)
  5. Observe the redirect of the site to browser language
  6. Cahnge language
  7. Go to http://localhost again and observe the same redirect to browser language. Headers include "Cache-Control:public, s-maxage=36000"

Expected behavior in step number 7: Redirect to the language selected in step 6 and headers should include "Cache-Control:max-age=0, must-revalidate, no-store, public, s-maxage=0"

The pull request fixes this.

acasademont commented 8 years ago

Then the issue is in the SF Reverse Proxy, not here. This is the output on the prefix strategy when there is no proxy:

Cache-Control: no-cache

Which is the expected one.