tomcat 已从响应中删除包含值的HTTP响应标头[Saved-url],因为它无效

s3fp2yjn  于 2023-10-19  发布在  其他
关注(0)|答案(1)|浏览(309)

我在Tomcat日志中看到以下警告:

WARN 1208786 --- [http-nio-8080-exec-2] o.apache.coyote.http11.Http11Processor   : The HTTP response header [Saved-url] with value [https://example.com/jobs/1234/сценарист-для-youtube-каналу] has been removed from the response because it is invalid

java.lang.IllegalArgumentException: The Unicode character [СЃ] at code point [1,089] cannot be encoded as it is outside the permitted range of 0 to 255
    at org.apache.tomcat.util.buf.MessageBytes.toBytesSimple(MessageBytes.java:286) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.tomcat.util.buf.MessageBytes.toBytes(MessageBytes.java:259) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.http11.Http11OutputBuffer.write(Http11OutputBuffer.java:389) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.http11.Http11OutputBuffer.sendHeader(Http11OutputBuffer.java:368) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1051) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:376) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.Response.action(Response.java:210) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.Response.sendHeaders(Response.java:444) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:287) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:246) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.catalina.connector.Response.finishResponse(Response.java:413) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:370) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:894) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1740) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.11.jar!/:na]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.11.jar!/:na]

我应该担心这个吗?如果是这样,我如何正确配置Sping Boot /Tomcat来解决这个问题?

iyfjxgzm

iyfjxgzm1#

这是因为作为HTTP合规服务器的Tomcat试图强制执行HTTP头规则,即HTTP头和值中的任何字符都应该在0 to 255的ASCII代码内。但是现在您的应用程序发送了一个响应,其Saved-url头中的值违反了这一规则,因此tomcat将其删除。
客户端仍然可以接收到响应正文和预期的状态码。它只是找不到任何Saved-url响应头。
并简要检查与tomcat源代码的相关部分,并不认为有办法配置这样的检查。

相关问题