John
April 30, 2015 02:44AM
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect says:

"(proxy_redirect) Sets the text that should be changed in the “Location” and “Refresh” header fields of a proxied server response."

All examples I found online only mentioned how it works with "Location", and that also works perfectly with me.

But it just doesn't work with "Refresh" for me. My backend site http://192.168.1.9/test.html is:

<html><head>
<meta http-equiv="refresh" content="0;url=http://192.168.1.9/" />
</head></html>

The nginx on my proxy 1.2.3.4 reads:

location / {
proxy_pass http://192.168.1.9;
proxy_set_header Host $host;
proxy_redirect default;
proxy_redirect http://192.168.1.9/ /;
proxy_redirect http://$proxy_host/ /;
proxy_redirect ~.* /;
proxy_redirect / /;
}

You can see I have exhausted all options on that nginx documentation. But after restarting nginx, "curl 1.2.3.4/test.html" still sees that "Refresh" line not translated to http://1.2.3.4/, and visiting http://1.2.3.4/test.html on browser will still redirect me to http://192.168.1.9/, which is unreachable.

Did I miss anything? Actually I don't understand that line about "proxy_set_header Host $host", I just copied from web.

Thank you!

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxy_redirect not working with "refresh"

John April 30, 2015 02:44AM

Re: proxy_redirect not working with "refresh"

Francis Daly April 30, 2015 04:12AM

Re: proxy_redirect not working with "refresh"

John May 01, 2015 02:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 270
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready