在tomcat 7中编码正斜杠和反斜杠?

编程入门 行业动态 更新时间:2024-10-24 04:37:36
本文介绍了在tomcat 7中编码正斜杠和反斜杠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-30 04:20:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1389347.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:斜杠   tomcat

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!