Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot remove Cache-Control: no-cache="set-cookie" in Apache2

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!

like image 530
Clay Graham Avatar asked Nov 14 '22 04:11

Clay Graham


1 Answers

Try to put the unset header under location:

<Location "/">
   Header unset Cache-Control
</Location>
like image 91
Maoz Zadok Avatar answered Dec 06 '22 04:12

Maoz Zadok