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

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.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments