Nginx redirect with rewrite -
Nginx redirect with rewrite -
assuming want redirect uris like
http://server1:8081/test/admin/option?options http://server1:8081/test/admin/option/suboption?options http://server1:8081/test/admin/option/suboption/subsuboption?options to
http://server2:8080/tomcat/admin/option?options http://server2:8080/tomcat/admin/option/suboption?options http://server2:8080/tomcat/admin/option/suboption/subsuboption?options what nginx rules have use? i've tried next doesn't work
location =/test/admin { proxy_pass http://server2:8080/tomcat/admin; proxy_redirect off; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; }
try along these lines ..
location /test/admin { rewrite ^/test/admin(.*)$ /tomcat/admin$1; } location /tomcat/admin { internal; proxy_pass http://server2:8080; […] } that is, rewrite requests "tomcat/admin" can optionally create open internal requests only.
in location block, can proxy passthe request.
nginx
Comments
Post a Comment