The valid characters are defined in RFC 7230 and RFC 3986

Posted 小泉哥

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The valid characters are defined in RFC 7230 and RFC 3986相关的知识,希望对你有一定的参考价值。

问题:IE11下请求报错

上面的图片中,我们明确看到这样一行Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986,这句话的大致意思就是说请求头中包含了 RFC 7230 and RFC 3986规范中定义的非法字符。在这种情况下就会导致页面报400异常。

引发问题代码:

var url = "/pcms/booking/init.do?startTime=" + startTime + "&roomId=" + roomid+"&roomName="+roomName;
window.location.href = url;

其中roomName是中文。

解决问题:

在前端对前端URL进行编码,后台进行解码。

var url = "/pcms/booking/init.do?startTime=" + startTime + "&roomId=" + roomid+"&roomName="+encodeURI(encodeURI(roomName));
window.location.href = url;
roomName = URLDecoder.decode(roomName,"utf-8");

问题解决~

以上是关于The valid characters are defined in RFC 7230 and RFC 3986的主要内容,如果未能解决你的问题,请参考以下文章

Springboot 报错 Invalid character found in the request target. The valid characters are defined in RFC

异常:Invalid character found in the request target. The valid characters are defined in RFC 3986

问题Invalid character found in the request target. The valid characters are defined in RFC 7230 and (代

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

解决Invalid character found in the request target. The valid characters are defined in RFC 7230 and RF