Temporary Redirect 307

Hi, I cannot find anywhere an answer to the following rather simple
question .

How can i make a temporary (307) redirect using nginx.

For example i want to have this:

set $optika PUBLICIP;
if ($host != $optika) {
rewrite ^/(.*)$ http://$optika/$1 redirect;

So for example i have:

i want to redirect it to:
http://XX.XX.XX.XX/largefile.mpg (which is a faster link but with a
dynamic ip)

the moment the IP is changed the PUBLICIP is updated and the nginx
config is reloaded…
The browsers which already asked for the file will cache it and will
directly try to find via the PUBLICIP which is no longer valid. I need
them to re-ask the example.com again so it gives them the correct
location. I understand that this is done via 307 rather than the default
302 which nginx uses… Do i need to recompile? What if i need both 302
and 307 etc etc…

Thank you very much in advance.

On 10/25/10 11:05, Igor Janevski wrote:

rewrite … redirect
return http 302 and it is temporary redirect.

From RFC:

10.3.3 302 Found

The requested resource resides temporarily under a different URI. Since
redirection might be altered on occasion, the client SHOULD continue to
use the
Request-URI for future requests. This response is only cacheable if
indicated by
a Cache-Control or Expires header field.

Why you need http 307?

Anton Y.

As far as i can tell google chrome on linux does that and IE for sure.
To be more precise whenever i have a JS, PNG or something static and the
IP changes the browser still uses the last IP and fails loading.
Probably it might be the cache settings but i don’t want to change
anything else in the configuration . I read somewhere that 307 redirects
are not cached by the browser, i.e. it will request it again from the
original adress (the static one, http://example.com/big.mpg) , that one
will redirect to the dynamic which will return the data or or just
not-modified …

IMHO, that clearly differs from 302 redirect .

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs