问题描述
限时送ChatGPT账号..我尝试发送像 http://site/abc%2Fabc 这样的请求,但它没有t 工作(发送状态 400).我如何理解 tomcat 出于安全原因不接受编码路径分隔符,但我不知道如何启用此编码.(我发现只有选项 AllowEncodedSlashes 用于 apache http 服务器).你能帮我吗?
I try send request like http://site/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?
更新
我使用小技巧解决了这个问题 - 在渲染之前替换 '|' 上的所有 '/' 字符并在/"上反转此字符后
I fixed this trouble using tiny hack - before render replace all '/' characters on '|' and after reverse this characters on '/'
推荐答案
Tomcat 选项允许使用编码的路径分隔符.
There is a Tomcat option to allow encoded path separators.
将 CATALINA_OPTS 环境变量设置为
Set the CATALINA_OPTS env var to
-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
这将允许编码斜杠.
这篇关于在tomcat 7中编码正斜杠和反斜杠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论