-
Notifications
You must be signed in to change notification settings - Fork 361
PageSpeed output resources cannot be cached in Google Cloud #1149
Comments
Hi -- I'm getting some clarification from some people that know more about On Fri, Mar 11, 2016 at 6:35 AM, Joyce Babu [email protected]
|
Adding "public" to the cache-control value is a requirement for Google CDN, but is not required by the HTTP spec. https://cloud.google.com/compute/docs/load-balancing/http/cdn describes the Google requirements, which are pretty clear. To meet these without adding an unnecessary qualifier for other caches, we can gate this logic on the presence of response-header |
Joyce: is it possible for you to add a workaround for this problem in your nginx config? That might help you get better behavior until we can add this functionality to a PageSpeed release. |
I tried disabling all rewriting rules, and using
Google CDN did not cache those resources, even though it is technically equivalent to
Did you mean request-header?
I am unable to modify the Cache-Control headers from nginx config. I tried using |
Yes I meant the Via request-header :) there is not an nginx equivalent to apache's "header set" directive? On Sat, Mar 12, 2016 at 3:37 AM, Joyce Babu [email protected]
|
Yes, there is the Setting the (experimental) environment variable Thank you. |
Glad you found a workaround, but I want to leave this open till we fix it properly. |
This auto-closed when I subbmitted the partial fix: apache/incubator-pagespeed-mod@6d81e80 This fix propagates cache-control:public from origin resources to rewritten resources. However, it does not infer that we need cache-control:public when running inside GCE, which it can do with the "Via" request header, if that includes the substring 'google'. |
via:*google*. Completes the fix to apache/incubator-pagespeed-ngx#1149 A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile also we must make sure we don't cache the 'public' based on the request headers.
It gonna help me as ..as google cdn requires public header. |
You can get this today if you build in trunk, or you can wait for a release that includes this bug fix, but I don't have a date for you yet. |
Can wait for it. Thanks for the hard work. |
Partially fixes apache/incubator-pagespeed-ngx#1149 General strategy: - adjust general mechanism for computing output response header from input response headers to incorporate 'public' on input. A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile Propagate 'cache-control:public' from inputs to outputs. Partially fixes apache/incubator-pagespeed-ngx#1149 General strategy: - adjust general mechanism for computing output response header from input response headers to incorporate 'public' on input. A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile fixup fixup for c++03 more c++03isms rm unused include
Partially fixes apache/incubator-pagespeed-ngx#1149 General strategy: - adjust general mechanism for computing output response header from input response headers to incorporate 'public' on input. A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile Propagate 'cache-control:public' from inputs to outputs. Partially fixes apache/incubator-pagespeed-ngx#1149 General strategy: - adjust general mechanism for computing output response header from input response headers to incorporate 'public' on input. A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile fixup fixup for c++03 more c++03isms rm unused include rm override (no c++11 on branch 33) Also add 'public' to non-private cache-control if request has via:*google*. Completes the fix to apache/incubator-pagespeed-ngx#1149 A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile also we must make sure we don't cache the 'public' based on the request headers.
Partially fixes apache/incubator-pagespeed-ngx#1149 General strategy: - adjust general mechanism for computing output response header from input response headers to incorporate 'public' on input. A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile Propagate 'cache-control:public' from inputs to outputs. Partially fixes apache/incubator-pagespeed-ngx#1149 General strategy: - adjust general mechanism for computing output response header from input response headers to incorporate 'public' on input. A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile fixup fixup for c++03 more c++03isms rm unused include rm override (no c++11 on branch 33) Also add 'public' to non-private cache-control if request has via:*google*. Completes the fix to apache/incubator-pagespeed-ngx#1149 A challenge here is to make sure we test all the egress points, e.g. - pagespeed resources: cached and reconstructed on demand - fallbacks of various sorts - ipro resources: cached and reconstructed on demand - loaded from LoadFromFile also we must make sure we don't cache the 'public' based on the request headers. Add a method to add 'public' to response-headers if via:*google is present in request-headers. c++03
Thanks for the effort on this @jmarantz @crowell! We've been running into the same issues with Cloud CDN on the mod_pagespeed side and trying to come up with workaround based on where this hooks in our chain—and I'm glad to have found this issue over on the ngx_pagespeed tracker. I see that about a month and a half ago that there wasn't a date for this to roll out yet—does anyone know if there's a window scheduled for an upcoming release? I haven't seen one in quite a while, so I'm mostly just trying to figure out if it's worth building trunk or if my laziness will pay off ;) Thanks again all! |
We're working on getting the release rolled out this week. We'll make an announcement on the mailing lists when it is available. |
Any update on this? We really need that new version of ngx_pagespeed module(( |
New version with a fix just got released earlier today: |
Just a note for those looking for this on the mod_pagespeed site, this is available in the 1.11.33.3-beta version announced here: |
Any update on this issue? I see that a few versions have been released with a fix for this for both Apache and nginx but I am still unable to change the Cache-Control header for HTML responses. The only resource I can find about the Cache-Control header still being set is on the Configuring Downstream Caches page but this won't work for the Google Cloud CDN because the CDN doesn't allow the required configuration such as the PS-Capability header or the purge URL's. |
This was fixed a long time ago in apache/incubator-pagespeed-mod@c8dc73f and was released in 1.11, which is marked as stable. However, if you are talking about HTML responses, then this bug is not related to that at all. Note that caching HTML responses with ngx_pagespeed means you cannot enable any user-agent specific optimizations (e.g. webp transcoding). If that's acceptable, configure ModifyCachingHeaders ( https://modpagespeed.com/doc/configuration#ModifyCachingHeaders) and then NPS will just leave your headers alone. |
Currently pagespeed adds
Cache-Control:max-age=31536000
to optimized resources. Is it possible to addpublic
to it?Google CDN (alpha) requires 'Cache-Control: public' to be present for resources that must be cached.
The text was updated successfully, but these errors were encountered: