leon
leon

Reputation: 10395

Using Apache ProxyPass or Mod_jk with Tomcat when there are special characters in the URL path

I am struggling with a problem in ProxyPass. I have tried using Apache and Nginx to setup Proxypass with tomcat. Everything is fine, apart from when there is any character in the URL. I don't know whether it is a bug in Apache or what, the request URI I am getting in my program from Apache as proxy is different from using Tomcat without proxy. I am using "request.getRequestURI()" in Java Servlet. For example, if the URL is

/movies/logs, logs

Use Apache or Nginx setup ProxyPass or Mod_jk I got:

/movies/logs,%20logs

If I use Tomcat directly, I got:

/movies/logs%2C%20logs

Ideally, I want the URL to be the same one as I received in Tomcat. Can someone help me fix the problem?

Thanks so much in advance!

Upvotes: 0

Views: 1085

Answers (1)

marat
marat

Reputation: 1387

By default Apache canonicalises URL's before passing them further, and apparently tomcat alone does it differently. To prevent mod_proxy from modifying your URL's, add nocanon keyword to ProxyPass directive.

Note, that both spaces and commas are considered to be unsafe in RFC 1738 and should not be used unescaped.

Upvotes: 1

Related Questions