I'm using squid as a reverse proxy to accelerate access to some remote sites. I have noticed that Squid doesn't save objects in cache when the site uses http authentication.

Is it suppose to be like that? If yes, is there a workaround?

Another question: In reverse proxy configuration of ssl site will save objects in cache?

My configuration is Squid 2.6 as reverse proxy, cache_peer ... login=PASS

  • Semding HTTP header: Cache-Control "public" solve the problem. In Apache: <filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "public" </filesMatch> – milutin Mar 1 '12 at 11:07

Yes it's supposed to be like that - if Bob and Alice both use the same proxy to access the internet, and Bob accesses an authenticated site with his username and password, then how would the proxy be able to validate a request by Alice?

(i.e. yes, it is supposed to do that).

HTTP authentication is far from a good idea. Use a better authentication system, and make sure you return a Varies: Cookies header with any authenticated / cacheable content.

  • I'm using HTTP authentication on top of application authentication to avoid spiders etc. I my case there is one general username/password to the site. So it there a way to define squid to cache "Bob" requests? – milutin Mar 1 '12 at 7:15
  • Other question dose in reverse proxy configuration of ssl site will save objects in cache? – milutin Mar 1 '12 at 7:27
  • An HTTP proxy cannot cache SSL requests - but if it's a reverse proxy, you can terminate the SSL in front of the cache (e.g. using stunnel) – symcbean Mar 2 '12 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.