Temporary Redirect 307

Igor Janevski i.janevski at itearesearch.com
Mon Oct 25 11:05:40 MSD 2010


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;
      break;
   }

So for example i have:
http://example.com/largefile.mpg

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.

-- 
------------------------------------------------------------------------
Igor 	
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20101025/a08a2743/attachment.html>


More information about the nginx mailing list