filipecarneiro / ELabel

Open-source solution for electronic labels on wine bottles.
https://filipecarneiro.github.io/ELabel/
MIT License
17 stars 3 forks source link

Serve static assets with an efficient cache policy #6

Closed filipecarneiro closed 11 months ago

filipecarneiro commented 11 months ago

When a browser requests a resource, the server providing the resource can tell the browser how long it should temporarily store or cache the resource. For any subsequent request for that resource, the browser uses its local copy rather than getting it from the network.

Describe the solution you'd like Use Cache-Control header

Additional context

filipecarneiro commented 11 months ago

Test with curl -I

filipecarneiro commented 11 months ago

Test OK! 604800 seconds - 7 days

curl -I https://qr.doutorpc.net/img/warning-drinking-during-pregnancy.svg

HTTP/1.1 200 OK Server: nginx/1.17.6 Date: Mon, 11 Dec 2023 20:52:26 GMT Content-Type: image/svg+xml Content-Length: 7333 Connection: keep-alive Accept-Ranges: bytes Cache-Control: public, max-age=604800 ETag: "1da236df9c9b825" Last-Modified: Thu, 30 Nov 2023 09:17:01 GMT Strict-Transport-Security: max-age=31536000