How can I create a temporary Redirect in .htaccess that all browsers adhere to? -


multiple variations of question have been asked, can't seem find satisfying answer.

i add following .htaccess file

redirect 302 /test1 /test 

then browse website. redirected /test.
remove redirect, , browse website again. in chrome, firefox , internet explorer (latest versions on 2017-04-14) browsers use cached redirect, , send me /test. on edge, /test1.

as mentioned in other questions, kindof ok, per the rfc:

since redirection might altered on occasion, client should continue use request-uri future requests. 

note "should" in rfc lingo means advised, not obligatory. advised not cache redirect (and hence, go /test1), ok cache anyway. don't understand why browsers not follow rfc suggestion here, ...but there's that.

then there 303 redirect:

the 303 response must not cached, response second (redirected) request might cacheable. 

i have tested this. given rfc, redirect must not (as in ever) cached. edge , firefox play nice here, , don't cache it. internet explorer , chrome seem decide bluntly ignore rfc here, , keep on sending me /test.

are these known bugs?
misunderstanding rfc?
there any way, make sure redirects don't cached?

is solution using rewriterule? browsers can't cache target url's there, because never see them, , tend not cache target location, works me. (thanks @olaf dietsche)

rewriterule ^test1 /test 

(in use-case, want redirect website.com/file.pdf file. there no html page can add no-cache parameter to. users type url browsers manually)

the rfc (2616) states

this document has been superseded.

precisely, rfc 7231, explicitly states "obsoletes: 2616". , in case relevant sections 303 see other , appendix b. changes rfc 2616

the description of 303 (see other) status code has been changed allow cached if explicit freshness information given, , specific definition has been added 303 response get. (section 6.4.4)

so in cases, caching 303 response allowed.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -