Redirecting any URI to a unique one


I have a website, let’s call it

On this website, I have a servlet running on tomcat at:

From the outside world I want people to access that servlet using the
following URL:

Currently in my nginx conf file I have:

server {

location / {

The problem is that if anyone enters a URL such as, Tomcat spits back an ugly 404
page. So I would like that whatever request comes in, tomcat only sees, and thus serves the only servlet I have

Should I use a rewrite for that? Am I doing it the correct way? I have
tried a few things but they all failed, the page couldn’t load

I am advancing a bit.

If I enter, I get the servlet.

If I enter, for some magical
reason, I get redirected with: and
Firefox display that it failed to load the page.

I don’t know who is appending this index.jsp, it is certainly not me.

server {
listen 80;

error_log /usr/local/nginx/logs/servlet.log notice;

location / {

rewrite /.+ / break;

root      /usr/local/tomcat-4.1/webapps/servlet/WEB-INF/classes;
index     index.html;

proxy_redirect      off;

proxy_set_header    X-Real-IP $remote_addr;
proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header    Host $http_host;


} # End of the location /
} # End of server

Okay I got it working, I had to append the “last” flag instead of
“break”. But I don’t understand the difference between the two, the
wiki is not crystal clear about that. Does anyone have a good
explanation or can redirect me to an equivalent apache one?

Actually this is the full error message:

Too many redirects occurred trying to open”. This might occur if
you open a page that is redirected to open another page which then is
redirected to open the original page.