2

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?

5
  • Where did you put that config, and what's the rest of your relevant config? Sep 8, 2014 at 19:38
  • I put it in the htaccess file
    – onassar
    Sep 8, 2014 at 19:44
  • here's the rest of the access file: pastebin.com/zB57Uddp
    – onassar
    Sep 8, 2014 at 19:45
  • So it's not in there now? And do you know where the current contents of the header are coming from now? The fact that Cache-control isn't capitalized in the header that you're getting now tells me it's being set elsewhere in your config. Sep 8, 2014 at 19:56
  • I removed it because it didn't seem to work. Here are before and after of the htaccess file having the unset command. Before: i.imgur.com/PdKFhKE.png After: i.imgur.com/SFj7r31.png
    – onassar
    Sep 8, 2014 at 20:05

3 Answers 3

0

I'm guessing you've run into a bug because you have two different capitalizations of Cache-Control:

Cache-Control: max-age=259200, no-cache="set-cookie"
Cache-control: no-cache="set-cookie"

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, while Cache-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 normal Cache-Control (then a Header unset Cache-Control should nuke both values), or make Apache search for the matching case-insensitive name twice, which should hopefully work:

Header unset Cache-Control
Header unset Cache-control
1
  • Thanks for the thoughts Shane. I considered that and tried it, but it didn't work. I found the answer to the problem though (and realize I failed to include some auxiliary information about my set up). Going to answer it now
    – onassar
    Sep 8, 2014 at 20:29
0

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

0

Are you using mod_session?

There's a bug about this:

https://bz.apache.org/bugzilla/show_bug.cgi?id=61161

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .