Fix cache-control

This commit is contained in:
lowlighter
2021-02-18 21:49:07 +01:00
parent f323629361
commit bd8b980042
2 changed files with 6 additions and 4 deletions

View File

@@ -12,10 +12,12 @@ This is mostly intended for previews, to enjoy all features consider using GitHu
<summary>💬 Fair use</summary> <summary>💬 Fair use</summary>
To ensure service availability, shared instance has a few limitations: To ensure service availability, shared instance has a few limitations:
* Images are cached for 1 hour * Images are cached for 15 minutes
* Rendered metrics **won't be updated** during this time window when queried * Rendered metrics **won't be updated** during this time window when queried
* You can manually update rendering againg your metrics on [metrics.lecoq.io](https://metrics.lecoq.io) * You can manually update rendering againg your metrics on [metrics.lecoq.io](https://metrics.lecoq.io)
* There is a rate limiter enabled (it doesn't affect already cached metrics) * A rate limiter is enabled to prevent denial of service (it doesn't affect already cached metrics)
* Several plugins may not be available * Some plugins may not be available
Service is provided free of charge, so please be gentle with it 🙂
</details> </details>

View File

@@ -69,7 +69,7 @@
} }
//Cache headers middleware //Cache headers middleware
middlewares.push((req, res, next) => { middlewares.push((req, res, next) => {
res.header("Cache-Control", cached ? `public, max-age=${cached}` : "no-store, no-cache") res.header("Cache-Control", cached ? `public, max-age=${Math.round(cached/1000)}` : "no-store, no-cache")
next() next()
}) })