I'm trying to get my assets cached using Cloudflare
Cloudflare states here that "CloudFlare will not cache your site or static content if you have no-cache and private headers coming from your server"
As you can see from my file response, Cache-control: no-cache="set-cookie"
is coming through:
https://redbot.org/?uri=http%3A%2F%2Fdev.shareasimage.com%2Fstatic%2Fapp%2Fimages%2Fads%2Fts.ad.png
I've tried removing it using Header unset Cache-control
, but no luck
Has anyone run into this before?
I'm guessing you've run into a bug because you have two different capitalizations of
Cache-Control
:HTTP headers are case-insensitive, but you've probably run into an oddball edge case where Apache stops looking when it finds a match to what you're trying to remove - so the first one,
Cache-Control
, gets removed, whileCache-Control
doesn't.Either find where in your config or code the
Cache-control
header is being set and have it fully capitalize to the normalCache-Control
(then aHeader unset Cache-Control
should nuke both values), or make Apache search for the matching case-insensitive name twice, which should hopefully work:I failed to mention that my server(s) are behind a load balancer on AWS
AWS ELB (what they call their load balancers) have a setting call
stickiness
When you turn it on, they set a cookie to make sure visitors consistently get sent to the same server
This has the added side effect of adding the following header after your server fulfills the request:
Cache-control: no-cache="set-cookie"
I needed to turn off stickiness to prevent this header from being set
In retrospect, I should've outlined my setup more to help debug this
Thanks for your help Shane
Are you using mod_session?
There's a bug about this:
https://bz.apache.org/bugzilla/show_bug.cgi?id=61161