The Expires and Cache-Control flags form Apache server do not show

caching

#1

In cloud flare I have setup under Cache >> Browser Cache Expiration option “Respect existing headers” and even-though I did this I don’t get any Expires and Cache-Control fags in the response, that I set in Apache
regarding caching.

This is the response I get

HTTP/1.1 200 OK
Date: Thu, 30 Aug 2018 11:35:02 GMT
Content-Type: application/font-woff
Connection: keep-alive
Set-Cookie: __cfduid=d001d913f8ffd2b0a5605659a3212a9d61535628902; expires=Fri, 30-Aug-19 11:35:02 GMT; path=/; domain=.mysite.com; HttpOnly; Secure
Set-Cookie: AWSALB=984/MlUoL0qrEtqRCJMe/QZMiy8o6ipyZKRnhQ1f7rfqmCFDkn8ZqgutgoXuSosGCqpn0R+xtZVyDHfIhWTdOxY5hW/3RxsEBLFAwzXO0cXNB8gUsM6N2F/hQ8x+; Expires=Thu, 06 Sep 2018 11:35:02 GMT; Path=/
Last-Modified: Mon, 15 Dec 2014 09:40:45 GMT
ETag: W/“54f0-50a3e095ea140-gzip”
Vary: Accept-Encoding
CF-Cache-Status: MISS
Expect-CT: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
Server: cloudflare
CF-RAY: 4526f3a21d2764ab-FRA

In the apache2 I have everything set up: modules header and expire all enabled and I added all the necessary ExpiresByType rules, but still nothing is being shown, in header.

Is there some extra rule I missing regarding Cloudflare, so that I cloud get my origin cache rules. Any help would be much appreciated.


#2

Can you show us what the output of this request is, if you resolve directly to origin?

Here is an example with curl:
curl -I https://mysite.com/path --resolve mysite.com:443:<origin ip>


#3

hi martin, thanks for the quick answer, the thing is my servers sits behind load balancer, and load balancer only has and DNS name, so when I took the Ip address behind that balancer, to place it in --resolve. I still got and response that was still somehow cumming from cloudflare which should be impossible in this case

HTTP/1.1 200 OK
Date: Thu, 30 Aug 2018 13:35:57 GMT
Content-Type: application/font-woff
Connection: keep-alive
Set-Cookie: __cfduid=d816a3ec488b3b3e9f874f68d9cb534a91535636157; expires=Fri, 30-Aug-19 13:35:57 GMT; path=/; domain=.mysite.com; HttpOnly; Secure
Set-Cookie: AWSALB=WKnEeCraQv4bxIOH4sL+qPn4Vle2XpryLY1nmMwn2advJkFERrDCoE1IaFEk6OmpqzzIAhRASjOPB6Nb2IPG/kDeJMvkJZHYAqiJ9SVpetYag4BwzgiocOr6ZAar; Expires=Thu, 06 Sep 2018 13:35:57 GMT; Path=/
Last-Modified: Mon, 15 Dec 2014 09:40:45 GMT
ETag: W/“54f0-50a3e095ea140-gzip”
Vary: Accept-Encoding
CF-Cache-Status: MISS
Expect-CT: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
Server: cloudflare
CF-RAY: 4527a4bc6feb64a5-FRA

Thanks, for the help, I need to look in to this deeper, as to figure what I am doing wrong.


#4

Allright. That means that curl probably didnt resolve with the specified IP. The IP you tried resolving doesnt belong to Cloudflare, right?

Probably you could try to do a nslookup on the load balancers hostname. That will give you the IP of the load balancer.

Also if you try to curl a non-https url, make sure to change 443 to 80 in above mentioned example.