1

In my setup , I have a nginx server as a reverse proxy for my tomcat application servers. I use proxy_pass to connect to tomcat upstreams ..

location /test {
         proxy_pass http://upstream1/webapp1/gateway
}

Now if some one fires a request to my nginx server http://myserver.com/test.jsp , this request is also handled by the test location and passed to the tomcat instance.

The tomcat instance returns a 404,but nginx is not handling this 404 request . ( I already have pages defined for 404 in nginx level) ,instead the browser show the page directly from tomcat(with tomcat version information and all) . How can i block this. I dont want to expose my application server details.

thanks in advance

1

1 Answer 1

4

You have to tell nginx to intercept upstream errors with proxy_intercept_errors directive.

location /test {
    proxy_pass http://upstream1/webapp1/gateway;
    proxy_intercept_errors on;
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .