New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combined CSS not cacheable (Cache-Control: max-age=300,private) #1080

Open
julienmru opened this Issue May 14, 2015 · 10 comments

Comments

Projects
None yet
6 participants
@julienmru
Copy link

julienmru commented May 14, 2015

CentOS 6.6 - mod_pagespeed 1.9.32.3-4448 - Apache 2.2.15

After enabling CoreFilters on a website, I noticed CSS are not cacheable whereas other resources managed by mod_pagespeed (images, scripts are). Here's our test URL: http://reunion.orange.fr/meteo/?PageSpeedFilters=rewrite_css,combine_css

Here's our architecture:
https://cdn.orange.re (in-house CDN using nginx) >> http://reunion.orange.fr (nginx) >> http://reunion.orange.fr (apache on private IP, this is where mod_pagespeed is installed)

And our configuration:

ModPagespeedDomain http://cdn.orange.re
ModPagespeedDomain https://cdn.orange.re    
ModPagespeedMapOriginDomain http://localhost http://cdn.orange.re reunion.orange.fr
ModPagespeedMapOriginDomain http://localhost https://cdn.orange.re reunion.orange.fr

Any clue what's happening?

@julienmru julienmru changed the title CSS Combined CSS not cacheable (Cache-Control: max-age=300,private) May 14, 2015

@julienmru

This comment has been minimized.

Copy link

julienmru commented May 14, 2015

I have a stylesheet which is cacheable: https://cdn.orange.re/assets/css/A.print.css,qts=1418037241.pagespeed.cf.GhUTE4B2Xp.css

FYI, the original IP and User-agent is exposed to the Apache server (using mod_rpaf for the original IP).

@julienmru

This comment has been minimized.

Copy link

julienmru commented May 15, 2015

We've moved mod_pagespeed to the nginx on reunion.orange.fr and it did solve the issue.

Here's the filters I have disabled: rewrite_css,flatten_css_imports,fallback_rewrite_css_urls. As soon as they are enabled, CSS files are not cachable.

@jmarantz

This comment has been minimized.

Copy link
Contributor

jmarantz commented May 15, 2015

Hi -- a typical problem we've seen in the past resulting in PageSpeed
sending cc:max-age=300,private is when the user-agent or accept-header from
the client does not reach the server that responds with the resource. This
is usually because the CSS URL was prepared on behalf of a browser that can
handle WEBP images, but the user-agent/accept-header that tells us that
didn't reach the server serving the CSS.

I can describe more in detail about how that happens if you are
interested. But first I wanted to check: do the full request-headers reach
your resource servers? Or do they get stripped/pruned in the proxy flow?

We have seen this problem before with Cloudfront stripping
user-agent/accept.

-Josh

On Fri, May 15, 2015 at 1:04 AM, Julien Tessier notifications@github.com
wrote:

We've moved mod_pagespeed to the nginx on reunion.orange.fr and it did
solve the issue.

Here's the filters I have disabled:
rewrite_css,flatten_css_imports,fallback_rewrite_css_urls. As soon as they
are enabled, CSS files are not cachable.


Reply to this email directly or view it on GitHub
#1080 (comment)
.

@julienmru

This comment has been minimized.

Copy link

julienmru commented May 15, 2015

Hi @jmarantz,

Thanks for your feedback. User-Agent/Accept is forwarded all the way to the origin server but a couple of extra headers are added in between (prefixed by "X-") and Host is changed to "reunion.orange.fr" and HTTPS is converted to HTTP. Headers are lower-cased because we are using SPDY on the CDN.

I set up an example here: https://cdn.orange.re/tests/headers.php.

Please note the CDN caches files using their filename, so this may be an issue if the same filename is served to webp and jpeg browsers.

Thanks.

@jmarantz

This comment has been minimized.

Copy link
Contributor

jmarantz commented May 15, 2015

By default, PageSpeed puts webp-related CSS/images into different filenames
than non-webp, so it's friendly to CDNs.

I am wondering whether the http/https switch might change the computed
bytes of CSS referencing other files. Basically, if the content changes,
the md5 of the content changes, which is reflected in the .pagespeed. URL.
If pagespeed computes a response whose md5 does not match the URL in the
request, it serves it with cc:private max-age=300 on the assumption that
the content might be stale, so we don't want proxies to cache it.

However,
https://cdn.orange.re/assets/css/A.print.css,qts=1418037241.pagespeed.cf.GhUTE4B2Xp.css
has
no URL references at all so I don't see how the content could change. Can
you give me an example of a CSS file served with cc:private,max-age=300?

Thanks,
-Josh

On Fri, May 15, 2015 at 9:48 AM, Julien Tessier notifications@github.com
wrote:

Hi @jmarantz https://github.com/jmarantz,

Thanks for your feedback. User-Agent/Accept is forwarded all the way to
the origin server but a couple of extra headers are added in between
(prefixed by "X-") and Host is changed to "reunion.orange.fr" and HTTPS
is converted to HTTP. Headers are lower-cased because we are using SPDY on
the CDN.

I set up an example here: https://cdn.orange.re/tests/headers.php.

Please note the CDN caches files using their filename, so this may be an
issue if the same filename is served to webp and jpeg browsers.

Thanks.


Reply to this email directly or view it on GitHub
#1080 (comment)
.

@jeffkaufman

This comment has been minimized.

Copy link
Contributor

jeffkaufman commented Oct 23, 2015

@julienmru Are you still having this problem? If so, could you give us an example of a CSS file served with cc:private,max-age=300?

@Tarekajaj

This comment has been minimized.

Copy link

Tarekajaj commented Dec 16, 2016

Hello,
We are facing similar issue,
is this problem solved?
Thanks

@jeffkaufman

This comment has been minimized.

Copy link
Contributor

jeffkaufman commented Dec 16, 2016

@Tarekajaj Could you give me an example of a CSS file served with cc:private,max-age=300?

@abieri

This comment has been minimized.

Copy link

abieri commented Feb 13, 2017

Hi Jeff,

I'm experiencing the same issue. I got one server for the cdn and 3 webservers. All of them have pagespeed activated. The webservers are accessing to a cloudfront directly which origin is the CDN server. I get cc:private,max-age=300 only for webp assets. here is an example : https://cdn2.jrcigars.com/images/banner/1485963901632-1.jpeg/640/x400.pagespeed.ic.IpbcEckH0_.webp

Does that make sense? I found on one of your other reply that all instances should have exactly the same pagespeed config, can you explain that? My CDN doesn't have the same configuration as the 3 webservers. Is that the issue? To what extend should it be similiar?

Thanks

@bnegrao

This comment has been minimized.

Copy link

bnegrao commented Oct 26, 2017

Hello,

We're having this issue right now! Please check:

https://ogcss.infoglobo.com.br/9876543210/css/A.main.css.pagespeed.cf.eJTHJwiwVY.css

what is causing that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment