Coding forward and backward slashes in tomcat 7?

后端 未结 4 1014
孤城傲影
孤城傲影 2021-02-05 11:24

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, b

相关标签:
4条回答
  • 2021-02-05 12:07

    We can also add this entry "org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true" in catalina.properties to allow encoded slash in url.


    And to allow backslash you have to set different properties. Refer this url for different configuration.

    0 讨论(0)
  • 2021-02-05 12:17

    To make this workable for my by editing $CATALINA_HOME\conf\server.xml

    Old Value: <Connector ... protocol="HTTP/1.1"... />

    New Value: <Connector ... protocol="HTTP/1.1"... relaxedQueryChars='\ { } |' />

    I am using Tomcat 7.0.88

    0 讨论(0)
  • 2021-02-05 12:19

    Have you tried putting URIEncoding="UTF-8" in your <Connector in the server.xml?

    0 讨论(0)
  • 2021-02-05 12:22

    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.

    0 讨论(0)
提交回复
热议问题