Skip to content
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

Assets are not cached #368

Open
verglor opened this issue Aug 4, 2016 · 10 comments
Open

Assets are not cached #368

verglor opened this issue Aug 4, 2016 · 10 comments

Comments

@verglor
Copy link
Contributor

verglor commented Aug 4, 2016

Since version 2.9.0 assets are served with HTTP header Cache-Control: no-cache in production.

@davydotcom
Copy link
Contributor

Are you using non cache digested versions of the assets? Because that was a
correction made requiring a server etag check

On Aug 4, 2016 7:16 PM, "jako512" [email protected] wrote:

Since version 2.9.0 assets are served with HTTP header Cache-Control:
no-cache in production.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#368, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AABaEl9vSazJXBnRjGLpl3lJx3OqQn2Sks5qcnK8gaJpZM4JdNo-
.

@verglor
Copy link
Contributor Author

verglor commented Aug 5, 2016

I'm using assets with cache digest.

@davydotcom
Copy link
Contributor

can you send me a screen shot and sample header please?

@verglor
Copy link
Contributor Author

verglor commented Aug 5, 2016

Version 2.8.0 + PR#365:

λ curl -I https://www.zzz.sk/assets/logo-25ee681213a59b0c332c4fc085efd3ea.png
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 05 Aug 2016 12:42:55 GMT
Content-Type: image/png; charset=UTF-8
Content-Length: 1908
Connection: keep-alive
Last-Modified: Thu, 04 Aug 2016 23:37:08 GMT
ETag: "logo-25ee681213a59b0c332c4fc085efd3ea.png"
Vary: Accept-Encoding
Cache-Control: public, max-age=31536000
Strict-Transport-Security: max-age=31536000
X-XSS-Protection: 1; mode=block

Version 2.10.1:

λ curl -I https://stag.zzz.sk/assets/logo-25ee681213a59b0c332c4fc085efd3ea.png
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 05 Aug 2016 12:48:15 GMT
Content-Type: image/png; charset=UTF-8
Content-Length: 1908
Connection: keep-alive
Last-Modified: Pi, 05 aug 2016 12:44:48 GMT
ETag: "logo-25ee681213a59b0c332c4fc085efd3ea.png"
Vary: Accept-Encoding
Cache-Control: no-cache
Strict-Transport-Security: max-age=31536000
X-XSS-Protection: 1; mode=block

@davydotcom
Copy link
Contributor

Thank you! are you routing this through nginx direct to tomcat or using storagePath copy?

On Aug 5, 2016, at 8:52 AM, jako512 [email protected] wrote:

Version 2.8.0 + PR#365:

λ curl -I https://www.zzz.sk/assets/logo-25ee681213a59b0c332c4fc085efd3ea.png
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 05 Aug 2016 12:42:55 GMT
Content-Type: image/png; charset=UTF-8
Content-Length: 1908
Connection: keep-alive
Last-Modified: Thu, 04 Aug 2016 23:37:08 GMT
ETag: "logo-25ee681213a59b0c332c4fc085efd3ea.png"
Vary: Accept-Encoding
Cache-Control: public, max-age=31536000
Strict-Transport-Security: max-age=31536000
X-XSS-Protection: 1; mode=block
Version 2.10.1:

λ curl -I https://stag.zzz.sk/assets/logo-25ee681213a59b0c332c4fc085efd3ea.png
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 05 Aug 2016 12:48:15 GMT
Content-Type: image/png; charset=UTF-8
Content-Length: 1908
Connection: keep-alive
Last-Modified: Pi, 05 aug 2016 12:44:48 GMT
ETag: "logo-25ee681213a59b0c332c4fc085efd3ea.png"
Vary: Accept-Encoding
Cache-Control: no-cache
Strict-Transport-Security: max-age=31536000
X-XSS-Protection: 1; mode=block

You are receiving this because you commented.
Reply to this email directly, view it on GitHub #368 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AABaEjg8g3phUUbaL4o3u7eJUr2wWPZtks5qczINgaJpZM4JdNo-.

@verglor
Copy link
Contributor Author

verglor commented Aug 5, 2016

Direct nginx -> jetty

@majkelo
Copy link

majkelo commented Sep 28, 2016

Issue still confirmed on 2.11.0

@davydotcom
Copy link
Contributor

Id try a newer version and also @majkelo send an example. If the asset is not using a cache digest name it does a no-cache which doesn't mean its not being cached it means its asking the server to validate its ETag header properly

@majkelo
Copy link

majkelo commented Sep 28, 2016

I've included plugin inline and manually updated asset-pipeline-core to 2.11.2 (just like in #378 but without any changes in AssetPipelineFilter.groovy ) and it seems it's working!

btw I'm not sure about https://github.com/bertramdev/asset-pipeline/blob/d51380f5c3847e695cd81cbc9991aecba7a1ea9e/asset-pipeline-core/src/main/groovy/asset/pipeline/AssetPipelineResponseBuilder.groovy#L63
for example for file /assets/grid.css what property should I add to Config.groovy?

I already have:

    grails.assets.skipNonDigests = true
    grails.assets.enableDigests = true
    grails.assets.bundle = false

@olavgg
Copy link

olavgg commented Jul 11, 2017

I just noticed this on Grails 3.2.11 with asset-pipeline-grails:2.14.1 when I ran a standalone jar with prod environment.

My varnish server refused to cache images because of this.
Changing back to the older 2.8.2 version fixes this.

This happen with images and other kind blobs like fonts. Javascript and CSS works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants