I need to create a quite simple map in Nginx redirecting a subpath to another server that is located in the same subnet.
- Nginx server: 192.168.0.2
- Tomcat server: 192.168.0.3:8443
I tried to put this in the server section
location /tomcatapi/ {
rewrite /tomcatapi/(.*) $1 break;
proxy_pass http://192.168.0.3:8443;
}
but all I get accessing http://www.myservice.com/tomcatapi/ is a 500 error page and in nginx log file I have this error:
the rewritten URI has a zero length
What I am missing in this conf?