Search code examples
tomcattomcat7

Coding forward and backward slashes in tomcat 7?


I try send request like http://site.com/abc%2Fabc and it doesn't work (send status 400). How I understand tomcat doesn't accept encoded path separators for security reasons, but I don't know how to enable this coding. (I have found only option AllowEncodedSlashes for apache http server). Can you help me?

UPDATE

I fixed this trouble using tiny hack - before render replace all '/' characters on '|' and after reverse this characters on '/'


Solution

  • There is a Tomcat option to allow encoded path separators.

    Set the CATALINA_OPTS env var to

    -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
    

    This will allow encoded slashes.