解决Invalid character found in the request target. The valid characters are defined in RFC 7230 and RF
通过这里的回答,我们可以知道:
Tomcat在 7.0.73, 8.0.39, 8.5.7 版本后,添加了对于http头的验证。
具体来说,就是添加了些规则去限制HTTP头的规范性
参考这里
具体来说:
org.apache.tomcat.util.http.parser.HttpParser#IS_NOT_REQUEST_TARGET[]中定义了一堆not request target if(IS_CONTROL[i] || i > 127 || i == 32 || i == 34 || i == 35 || i == 60 || i == 62 || i == 92 || i == 94 || i == 96 || i == 123 || i == 124 || i == 125) {
IS_NOT_REQUEST_TARGET[i] = true;
}
转换过来就是以下字符(对应10进制ASCII看):
- 键盘上那些控制键:(
<32或者=127
) - 非英文字符(
>127
) 空格
(32
)双引号
(34
)#
(35
)<
(60
)>
(62
)反斜杠
(92
)^
(94
)TAB上面那个键,我也不晓得嫩个读
(96
){
(123
)}
(124
)
|
(125
)
解决办法1:
还是参考这里
即:
配置tomcat的catalina.properties
添加或者修改:
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
这种方法只适合对应的应为,如果为中文则就不行。如果有?和&这些符合那么
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}?&
解决办法2:
最轻便的方法,更换tomcat版本。此方法比较快。
解决办法3:
对相应的参数进行编码,就是将所有的参数都进行编码
解决方法4:
选择另外的参数传递方法,比如post或者localStorage。
本人采用的是直接更换tomcat版本,应为参数中包含中文,代码已经写好。不想修改,就直接还tomcat。当然,这种问题在Google浏览器中未发现,基本都是IE浏览器中出现。
需要更换那些版本的tomcat,可以直接下载对应的版本的tomcat
http://archive.apache.org/dist/tomcat/tomcat-6/
http://archive.apache.org/dist/tomcat/tomcat-7/
http://archive.apache.org/dist/tomcat/tomcat-8/
http://archive.apache.org/dist/tomcat/tomcat-9/
转载自https://www.cnblogs.com/lr393993507/p/7755867.html
解决Invalid character found in the request target. The valid characters are defined in RFC 7230 and RF的更多相关文章
- 解决Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 问题
通过这里的回答,我们可以知道: Tomcat在 7.0.73, 8.0.39, 8.5.7 版本后,添加了对于http头的验证. 具体来说,就是添加了些规则去限制HTTP头的规范性 参考这里 具体来说 ...
- 解决:Invalid character found in the request target.The valid characters are defined in RFC 7230 and RF
背景 在将tomcat升级到7.0.81版后,发现系统的有些功能不能使用了,查询日志发现是有些地址直接被tomcat认为存在不合法字符,返回HTTP 400错误响应,错入信息如下: 原因分析 经了解, ...
- Invalid character found in the request target. The valid characters are defined in RFC 7230 and RF
SpringBoot 请求参数包含 [] 特殊符号 返回400状态 //springBoot 启动类 添加 bean @Bean public TomcatServletWebServerFactor ...
- Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC
解决Invalid character found in the request target. The valid characters are defined in RFC 7230 and RF ...
- 解决springboot项目请求出现非法字符问题 java.lang.IllegalArgumentException:Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
springboot版本: 2.1.5 最近使用springboot搭建了一个App后台服务的项目,开发接口的时候在本机使用postman工具做请求测试,请求返回一直很正常,但是在前端开发使用h5请求 ...
- 已解决:Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 问题
请求: http://127.0.0.1:8080/driverApp/findLikeAddress?json={"shopname":"广东省"," ...
- Tomcat v7.0 java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
十二月 , :: 下午 org.apache.coyote.http11.AbstractHttp11Processor process 信息: Error parsing HTTP request ...
- Tomcat报错Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
问题描述:后台报错 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.java ...
- IE浏览器连接WebSocket报错:java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
在项目开发中整合了WebSocket,本来没什么问题了,但是偶尔发现用IE浏览器打开web端不能推送消息,因为PC端与服务器建立连接失败了.网上查了很多资料, 又看了看源码,都不对症:又怀疑是Spri ...
随机推荐
- 学习 Git Rebase
有问题为什么不问问神奇的 man 呢? rebase 也算是我比较常用的一个指令了,但是很长时间以来,对这个指令的认识还是不够深刻,于是就找了个时间认真地读了一下 git rebase 的文档.这份文 ...
- c++动态链接问题
https://blog.csdn.net/liu0808/article/details/81169173 https://blog.csdn.net/f110300641/article/deta ...
- javascript 从对象数组中 按字段/属性取最大值或最小值
var array=[ { "index_id": 119, "area_id": "18335623", "name" ...
- PIL和Pillow
关于Pillow与PIL PIL(Python Imaging Library)是Python一个强大方便的图像处理库,名气也比较大.不过只支持到Python 2.7. PIL官方网站:http:// ...
- Graph machine learning 工具
OGB: Open Graph Benchmark https://ogb.stanford.edu/ https://github.com/snap-stanford/ogb OGB is a co ...
- graph处理工具
仅作为记录笔记,完善中...................... 1 PyGSP https://pygsp.readthedocs.io/en/stable/index.html ht ...
- OpenLayers加载高德地图离线瓦片地图
本文使用OpenLayers最新版本V5.3.0演示:如何使用OpenLayer加载谷歌地球离线瓦片地图.OpenLayers 5.3.0下载地址为:https://github.com/openla ...
- Django框架(十三)——Auth模块
Auth模块 一.什么是auth模块 Auth模块是Django自带的用户认证模块 Auth模块是Django自带的用户认证模块,可以实现包括用户注册.用户登录.用户认证.注销.修改密码等功能.默认使 ...
- navicat连接mysql出现2059
1.找到mysql的目录:C:\Program Files\MySQL\MySQL Server 8.0\bin 2.清空此目录,输入cmd,回车 3.在控制台输入:mysql -u root -p ...
- 实战Go内存泄露【转】
最近解决了我们项目中的一个内存泄露问题,事实再次证明pprof是一个好工具,但掌握好工具的正确用法,才能发挥好工具的威力,不然就算你手里有屠龙刀,也成不了天下第一,本文就是带你用pprof定位内存泄露 ...