无法删除 Cache-Control: no-cache="set-cookie"在阿帕奇2中

发布于 2024-10-12 03:00:05 字数 2048 浏览 5 评论 0 原文

我是一个平庸的 apache2 配置专家,所以我希望 apache GODS 教我一个特定的标头,该标头导致某些浏览器不缓存 cookie,这是我正在做的 OAuth 实现所需要的。

当我运行命令时:

lwp-request -e -d http://foobar.com

我的站点 foobar.com 返回以下标头:

Cache-Control: no-cache="set-cookie"
Connection: Close
Date: Thu, 13 Jan 2011 06:18:00 GMT
Vary: Accept-Encoding
Content-Language: en-US
Content-Type: text/html;charset=UTF-8
Client-Date: Thu, 13 Jan 2011 06:18:01 GMT
Client-Peer: 50.16.212.144:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Link: </images/ic_fav_alpha_32.png>; /="/"; rel="shortcut icon"
Set-Cookie: JSESSIONID=C5055D83F9B5A52C062D8A9F616D62AB; Path=/
Set-Cookie: AWSELB=3505DFB9122FAFC80483E17CBEB5E23D24546B00A71218A5BAE3B79F14317437BEAEDA7FECDE95AFFF6463C9769D0D0E3214FD9D67BAA906438E5D0FA925CD323D7E860C2A;MAX-AGE=600
Title: Foobar Home
X-Meta-Description: Foobar Home Page
X-Meta-Generator: Foobar
X-Meta-Google-Site-Verification: u9YkTj5gr6aeYBst1Aac-B_5cCvJe_Ataauqep_EwEE
X-Meta-Googlebot: index,follow
X-Meta-Refresh: 20
X-Meta-Robots: index,follow

因此,我尝试在 apache2 的站点配置中取消设置 Cache-Control 标头,因为我认为此标头导致某些浏览器不接受 cookie。 我希望他们接受我的cookie!

<VirtualHost *:80>
        ServerName www.foobar.com
        ServerAlias foobar.com
        ProxyPass / ajp://localhost:8009/
        ProxyPassReverse / http://localhost:8080/
        ProxyPreserveHost On
        # alert, emerg.
        LogLevel warn
        ErrorLog /var/log/apache2/error.log
        CustomLog /var/log/apache2/access.log combined
        ServerSignature On
        Header unset Cache-Control
        Header append Cache-Control "public"
</VirtualHost>

现在我希望无缓存标头消失并成为 foobar.com 的“公共”,但这确实发生了。这是重新启动 apache2 后的 Cache-Control 标头:

Cache-Control: public
Cache-Control: no-cache="set-cookie"

这不是我的预期,我认为 unset 会取消设置特定类型的所有标头!

笔记。这是一个 apache http 服务器,在 localhost:8080 上的 tomcat 服务器前面充当 ajp 代理。我期待这应该不重要。

有什么想法如何摆脱这个讨厌的标题吗?

谢谢!

I am a mediocre apache2 configuration specialist so I am looking to the apache GODS to school me on a specific header that is causing some browsers to not cache cookies, which I need for an OAuth implementation I am doing.

When I run the command:

lwp-request -e -d http://foobar.com

my site foobar.com returns the following headers:

Cache-Control: no-cache="set-cookie"
Connection: Close
Date: Thu, 13 Jan 2011 06:18:00 GMT
Vary: Accept-Encoding
Content-Language: en-US
Content-Type: text/html;charset=UTF-8
Client-Date: Thu, 13 Jan 2011 06:18:01 GMT
Client-Peer: 50.16.212.144:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Link: </images/ic_fav_alpha_32.png>; /="/"; rel="shortcut icon"
Set-Cookie: JSESSIONID=C5055D83F9B5A52C062D8A9F616D62AB; Path=/
Set-Cookie: AWSELB=3505DFB9122FAFC80483E17CBEB5E23D24546B00A71218A5BAE3B79F14317437BEAEDA7FECDE95AFFF6463C9769D0D0E3214FD9D67BAA906438E5D0FA925CD323D7E860C2A;MAX-AGE=600
Title: Foobar Home
X-Meta-Description: Foobar Home Page
X-Meta-Generator: Foobar
X-Meta-Google-Site-Verification: u9YkTj5gr6aeYBst1Aac-B_5cCvJe_Ataauqep_EwEE
X-Meta-Googlebot: index,follow
X-Meta-Refresh: 20
X-Meta-Robots: index,follow

So I attempt to unset the Cache-Control header in my site config for apache2 because I think this header is causing some browsers to not accept cookies. I want them to accept my cookies!

<VirtualHost *:80>
        ServerName www.foobar.com
        ServerAlias foobar.com
        ProxyPass / ajp://localhost:8009/
        ProxyPassReverse / http://localhost:8080/
        ProxyPreserveHost On
        # alert, emerg.
        LogLevel warn
        ErrorLog /var/log/apache2/error.log
        CustomLog /var/log/apache2/access.log combined
        ServerSignature On
        Header unset Cache-Control
        Header append Cache-Control "public"
</VirtualHost>

And now I would expect the no-cache header to disappear and to become "public" for foobar.com, but that does occur. This is the Cache-Control headers after restarting apache2:

Cache-Control: public
Cache-Control: no-cache="set-cookie"

This is not my expectation, I thought unset would unset all Headers of a specific type!

Note. This is an apache http server that is acting as an ajp proxy in front of a tomcat server on localhost:8080. I am expecting that should not matter.

Any ideas how to get rid of this pesky header?

THANKS!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

巷雨优美回忆 2024-10-19 03:00:05

尝试将未设置的标头放在以下位置:

<Location "/">
   Header unset Cache-Control
</Location>

Try to put the unset header under location:

<Location "/">
   Header unset Cache-Control
</Location>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文