Fix cache-control
This commit is contained in:
8
.github/readme/partials/setup/shared.md
vendored
8
.github/readme/partials/setup/shared.md
vendored
@@ -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>
|
||||||
|
|||||||
@@ -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()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user