可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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 '/'
回答1:
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.
回答2:
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.
回答3:
Have you tried putting URIEncoding="UTF-8" in your <Connector in the server.xml?
回答4:
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