Skip to content

Increase max-age of assets to 1 year

Created by: heyajulia

This commit increases the max-age of assets to 31536000 seconds (one year) to improve loading times.

Fixes sourcegraph/sourcegraph#34433.

Test plan

Before switching the branch with my change, run Sourcegraph and send a request to, for example, http://sourcegraph.test:3080/.assets/img/sourcegraph-mark.svg?v=2:

$ curl -I "http://sourcegraph.test:3080/.assets/img/sourcegraph-mark.svg?v=2"
HTTP/1.1 405 Method Not Allowed
X-Powered-By: Express
allow: GET
cache-control: immutable, max-age=172800, public
content-length: 45
content-type: text/plain; charset=utf-8
date: Thu, 19 May 2022 14:03:39 GMT
server: Caddy
x-content-type-options: nosniff
connection: close
Vary: Accept-Encoding

Note that the max-age is 172800, as expected.

But when we run Sourcegraph using the code from my branch:

$ curl -I "http://sourcegraph.test:3080/.assets/img/sourcegraph-mark.svg?v=2"
HTTP/1.1 405 Method Not Allowed
X-Powered-By: Express
allow: GET
cache-control: immutable, max-age=31536000, public
content-length: 45
content-type: text/plain; charset=utf-8
date: Thu, 19 May 2022 14:06:14 GMT
server: Caddy
x-content-type-options: nosniff
connection: close
Vary: Accept-Encoding

Now, the max-age is 31536000, as expected.

Merge request reports

Loading