解决Invalid character found in the request target. The valid characters are defined in RFC 723。。。

今天在做一个推送请求时触发了该异常,简单做下记录:
异常原因:请求url中含有特殊符号,我的特殊符号是【{}】及【:】等,因为我的请求参数中有json数据
示例:http://192.168.3.238:8084/fire-bbs/ad/hua?user={“pid”:“15911” }&message={“notification”:{“title”:“测试标题”,“body”:“内容”},“android”:{“coe_key”:-1}}

解决方案

// tomact服务器的catalina.policy文件末尾添加:
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true

即:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42258975/article/details/112562980