You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
PageSpeed output resources cannot be cached in Google Cloud #1149
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 add_header 'Cache-Control' public;. This resulted in two Cache-Control headers
Cache-Control:max-age=604800
Cache-Control: public
Google CDN did not cache those resources, even though it is technically equivalent to Cache-Control:max-age=604800, public
To meet these without adding an unnecessary qualifier for other caches, we can gate this logic on the presence of response-header
Did you mean request-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 am unable to modify the Cache-Control headers from nginx config. I tried using POSITION_AUX=true, still I am unable to modify the headers. I remember seeing a comment by Jeff in another issue that nginx location blocks targeting optimized resources doesn't work when LoadFromFile is enabled.
I tried disabling all rewriting rules, and using add_header
'Cache-Control' public;. This resulted in two Cache-Control headers
Cache-Control:max-age=604800
Cache-Control: public
Google CDN did not cache those resources, even though it is technically
equivalent to Cache-Control:max-age=604800, public
To meet these without adding an unnecessary qualifier for other caches, we
can gate this logic on the presence of response-header
Did you mean request-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 am unable to modify the Cache-Control headers from nginx config. I tried
using POSITION_AUX=true, still I am unable to modify the headers. I
remember seeing a comment by Jeff in another issue that nginx location
blocks don't when LoadFromFile is enabled.
—
Reply to this email directly or view it on GitHub #1149 (comment)
.
there is not an nginx equivalent to apache's "header set" directive?
Yes, there is the add_header directive and the more_set_headers directive. But from what I understand, the header filter appears before ngx_pagespeed in the nginx filter chain. Hence, headers are always intercepted and modified by ngx_pagespeed.
Setting the (experimental) environment variable POSITION_AUX=true is supposed to move ngx_pagespeed's position, so that it will be possible to modify the headers from nginx config. I just found out that it was not working because a change introduced for nginx 1.9.11+ had broken that option. After fixing it, now I am able to do more_set_headers "Cache-Control: max-age=31536000, public";
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'.
changed the title [-]Set Cache-Control: public on pagespeed optimized resources[/-][+]Set Cache-Control: public on pagespeed optimized resources when running in Google cloud[/+]on Aug 2, 2016
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 ;)
changed the title [-]Set Cache-Control: public on pagespeed optimized resources when running in Google cloud[/-][+]PageSpeed output resources cannot be cached in Google Cloud[/+]on Aug 12, 2016
Any update on this? We really need that new version of ngx_pagespeed module((
GoogleCDN will not work for the all servers that use pagespeed))) This is contradictorily assuming that pagespeed is also related/mainteined by Google company.
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.
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.
Activity
jmarantz commentedon Mar 11, 2016
Hi -- I'm getting some clarification from some people that know more about
the CDN.
On Fri, Mar 11, 2016 at 6:35 AM, Joyce Babu notifications@github.com
wrote:
jmarantz commentedon Mar 12, 2016
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
Via: 1.1 google
jmarantz commentedon Mar 12, 2016
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.
JoyceBabu commentedon Mar 12, 2016
I tried disabling all rewriting rules, and using
add_header 'Cache-Control' public;. This resulted in two Cache-Control headersGoogle CDN did not cache those resources, even though it is technically equivalent to
Cache-Control:max-age=604800, publicDid you mean request-header?
I am unable to modify the Cache-Control headers from nginx config. I tried using
POSITION_AUX=true, still I am unable to modify the headers. I remember seeing a comment by Jeff in another issue that nginxlocationblocks targeting optimized resources doesn't work when LoadFromFile is enabled.jmarantz commentedon Mar 12, 2016
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 notifications@github.com
wrote:
JoyceBabu commentedon Mar 12, 2016
Yes, there is the
add_headerdirective and themore_set_headersdirective. But from what I understand, theheaderfilter appears beforengx_pagespeedin the nginx filter chain. Hence, headers are always intercepted and modified byngx_pagespeed.Setting the (experimental) environment variable
POSITION_AUX=trueis supposed to movengx_pagespeed's position, so that it will be possible to modify the headers from nginx config. I just found out that it was not working because a change introduced for nginx 1.9.11+ had broken that option. After fixing it, now I am able to domore_set_headers "Cache-Control: max-age=31536000, public";Thank you.
jmarantz commentedon Mar 12, 2016
Glad you found a workaround, but I want to leave this open till we fix it properly.
jmarantz commentedon Jun 16, 2016
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'.
Also add 'public' to non-private cache-control if request has
2 remaining items
dhirenpratap commentedon Jun 29, 2016
Can wait for it. Thanks for the hard work.
Propagate 'cache-control:public' from inputs to outputs.
Propagate 'cache-control:public' from inputs to outputs.
Propagate 'cache-control:public' from inputs to outputs.
[-]Set Cache-Control: public on pagespeed optimized resources[/-][+]Set Cache-Control: public on pagespeed optimized resources when running in Google cloud[/+]justbeez commentedon Aug 5, 2016
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!
crowell commentedon Aug 9, 2016
We're working on getting the release rolled out this week. We'll make an announcement on the mailing lists when it is available.
[-]Set Cache-Control: public on pagespeed optimized resources when running in Google cloud[/-][+]PageSpeed output resources cannot be cached in Google Cloud[/+]olekstumedia commentedon Aug 16, 2016
Any update on this? We really need that new version of ngx_pagespeed module((
GoogleCDN will not work for the all servers that use pagespeed))) This is contradictorily assuming that pagespeed is also related/mainteined by Google company.
morlovich commentedon Aug 16, 2016
New version with a fix just got released earlier today:
https://groups.google.com/forum/#!topic/ngx-pagespeed-discuss/flIW0eAdVFw
justbeez commentedon Aug 19, 2016
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:
https://groups.google.com/forum/#!topic/mod-pagespeed-announce/UMCmeItofcY
nathanjosiah commentedon May 31, 2017
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.
jmarantz commentedon May 31, 2017
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.
Propagate 'cache-control:public' from inputs to outputs.