Redirecting any URI to a unique one

Thomas iamkenzo at gmail.com
Thu Apr 24 13:45:06 MSD 2008


Hi,

I have a website, let's call it www.mysite.com

On this website, I have a servlet running on tomcat at:
http://127.0.0.1:8080/servlet/service1

>From the outside world I want people to access that servlet using the
following URL:
http://servlet.mysite.com

Currently in my nginx conf file I have:

server {
 server_name servlet.mysite.com;

location / {
 proxy_pass http://127.0.0.1:8080/servlet/service1;
 }
}


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

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
anymore.





More information about the nginx mailing list