gpt4 book ai didi

apache - 如何删除 Tomcat 中的特定 cookie?

转载 作者:行者123 更新时间:2023-11-28 23:40:35 26 4
gpt4 key购买 nike

在我的 Tomcat 7(与我的 Ubuntu 12.04 LTS 服务器捆绑在一起)中,我安装了一个 Jasig CAS 的实例。 3.5.1.

问题是在特定情况下,某些客户端浏览器会通过包含重音字符的 Google Analytics cookie 到达我的 CAS:

Cookie: __utma=138551020.224991009.1377788460.1385030099.1385031617.283; __utmb=138551020.3.10.1385031617; __utmc=137551020; __utmz=137551020.1385931617.283.104.utmcsr=YMLP|utmccn=Coup%20de%20théatre|utmcmd=email|utmctr=mmp4_TestOctobre2013.png

在那种情况下,Tomcat 无法处理它!

Nov 21, 2013 1:35:41 PM org.apache.coyote.ajp.AjpAprProcessor process
SEVERE: Error processing request
java.lang.IllegalArgumentException: Control character in cookie value or attribute.
at org.apache.tomcat.util.http.CookieSupport.isHttpSeparator(CookieSupport.java:193)
at org.apache.tomcat.util.http.Cookies.getTokenEndPosition(Cookies.java:502)
at org.apache.tomcat.util.http.Cookies.processCookieHeader(Cookies.java:291)
at org.apache.tomcat.util.http.Cookies.processCookies(Cookies.java:168)
at org.apache.tomcat.util.http.Cookies.getCookieCount(Cookies.java:106)
at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:919)
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:688)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:402)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:197)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1763)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)

我正在使用 Apache 2(捆绑在 Ubuntu 中)来代理具有该配置的请求:

ProxyPass /cas ajp://localhost:8009/cas
ProxyPassReverse /cas https://sso.mycompany.com/cas

问题是:我可以在将请求发送到 Tomcat 之前用 Apache 删除那个特定的重音 Cookie 值吗?

(我已经看到 in the sources 没有办法告诉 Tomcat“不要理会控制字符,无论如何都要解析我的 cookie”)

最佳答案

作为said here , 使用 mod_headers :

<Location "/cas">
RequestHeader edit Cookie "^(.*?)\|utmccn=.*?(\|.*)$" $1$2
</Location>

关于apache - 如何删除 Tomcat 中的特定 cookie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20123724/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com