There was here a little problem to redirect using nginx with a certain request to the site. To carry out our mission, I will give an example config:
bash:
-
server {
-
listen 80;
-
server_name www.site.ru site.ru;
-
reset_timedout_connection on;
-
location ~* /Service {
-
proxy_pass http://avia.go2see.ru;
-
}
-
location ~* /Service2 {
-
rewrite ^ http://demo.site.ru/Service2 permanent;
-
}
-
location / {
-
proxy_pass http://www/;
-
proxy_next_upstream error timeout invalid_header http_500 http_503;
-
proxy_set_header Host $host;
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
proxy_redirect off;
-
proxy_connect_timeout 120;
-
}
-
}
Unlike rewrite of proxy_pass is that the redirect will look “open”. Ie Page processed automatically forwarded to the new address.
In the case of a leave request proxy_pass “transparent”, ie user does not even realize that there was a request for a new url address.
Leave a Reply