Redirecting any URI to a unique one

Thomas iamkenzo at gmail.com
Thu Apr 24 16:39:09 MSD 2008


I am advancing a bit.

If I enter http://servlet.mysite.com, I get the servlet.

If I enter http://servlet.mysite.com/whatever, for some magical
reason, I get redirected with: http://servlet.mysite.com/index.jsp 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;
  server_name   servlet.mysite.com;

  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;

    proxy_pass http://127.0.0.1:8080/servlet/service1;
  } # End of the location /
} # End of server





More information about the nginx mailing list