question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add far futures expires to static content for the new frontend.

See original GitHub issue

From looking at https://www.webpagetest.org/performance_optimization.php?test=170927_7D_c174dc90ef600bdd9247e31192a3adf3&run=1#cache_static_content there’s some easy changes we can make to improve our perf scores.

Here’s the specific bit we’re interested in:

Leverage browser caching of static assets: 54/100

FAILED - (No max-age or expires) - https://addons.mozilla.org/favicon.ico?v=1
FAILED - (No max-age or expires) - https://addons-amo.cdn.mozilla.net/amo-e5a42058f1500c4581e317152d4778a7.css
FAILED - (No max-age or expires) - https://addons-amo.cdn.mozilla.net/amo-6fba0981b0db8c8231a7.js
FAILED - (No max-age or expires) - https://addons-amo.cdn.mozilla.net/af42317212d492ac0f5ffabd918b8493.woff2
FAILED - (No max-age or expires) - https://addons-amo.cdn.mozilla.net/979a13914c3398f40c3114ead422ed41.woff2
FAILED - (No max-age or expires) - https://addons-amo.cdn.mozilla.net/0eff19a04ae3b96909f34d747d538642.woff2
FAILED - (No max-age or expires) - https://addons-amo.cdn.mozilla.net/a1ea7f348ffcb1af730d8bb90d6c7792.woff2
FAILED - (No max-age or expires) - https://addons-amo.cdn.mozilla.net/2b8fee7c129fcad1c9014f69ccddc4a5.woff2
FAILED - (No max-age or expires) - https://addons-amo.cdn.mozilla.net/a4b5655f2fdbe07f1fe26d5a77ab79a9.woff2
FAILED - (No max-age or expires) - https://addons.mozilla.org/__cspreport__
FAILED - (No max-age or expires) - https://addons.mozilla.org/api/v3/addons/search/?app=firefox&author=Wladimir-Palant&page_size=7&sort=hotness&type=extension&lang=en-US
FAILED - (No max-age or expires) - https://addons.mozilla.org/__cspreport__
FAILED - (18.0 minutes) - https://www.google-analytics.com/analytics.js
WARNING - (2.0 days) - http://ocsp.digicert.com/
WARNING - (2.0 days) - http://ocsp.digicert.com/

There’s room for a few easy changes.

  • The JS, CSS and woff2 files should have far-futures expires headers. The bundling will change the URL to cause a request so a date in the future e.g. +10years should be good. @bqbn would you be able to make this change to our origin nginx?

Other issues filed elsewhere

The favicon is currently going to redirect. We should look to fix this by changing the URL to point to the right CDN directly (or alternatively the redirection should be made cacheable) the first option is probably better since it’s explicit. It should also be verified that the final resource response has far-futures expires. https://github.com/mozilla/addons-frontend/issues/3275.

Lastly we could possibly do something on the APIs responses to make them more cacheable - I’d be interested in thoughts on what a sane value for that would be or if we’d be better to stick to conditional requests instead to avoid stale content for any length of time. This might also be something that would be different depending on what part of the API is being called - we would need to make these changes in addons-server - See https://github.com/mozilla/addons-server/issues/6544 for the discussion around that.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
bqbncommented, Oct 2, 2017
0reactions
ValentinaPCcommented, Nov 7, 2017

Not a pb! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trying to implement "far-future expiration date" for static files in ...
I am attempting to use the far future expires method to cut down my site's load time. However when I access static files...
Read more >
Setting a far future expires header for your Rails app static ...
Setting a far future expires header for your static assets is one of the first front end performance improvements you must do in...
Read more >
Far Future Expiry Header – WordPress plugin
This plugin will add a far future expiry header for various file types to improve page load speed of your site.
Read more >
WordPress Far Future Expiration Plugin - Tips and Tricks HQ
This plugin will allow you to easily add a “far future expiration” date for various static file types on your WordPress powered site...
Read more >
Web Caching Best Practices - Bits and Pieces
For example, if your website started with static content initially, the expiry of cache control headers would be set to far-future dates.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found