Skip to content

Commit

Permalink
Fix cache-control
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed Feb 18, 2021
1 parent f323629 commit bd8b980
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/readme/partials/setup/shared.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ This is mostly intended for previews, to enjoy all features consider using GitHu
<summary>💬 Fair use</summary>

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
* 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)
* Several plugins may not be available
* A rate limiter is enabled to prevent denial of service (it doesn't affect already cached metrics)
* Some plugins may not be available

Service is provided free of charge, so please be gentle with it 🙂

</details>
2 changes: 1 addition & 1 deletion source/app/web/instance.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
}
//Cache headers middleware
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()
})

Expand Down

0 comments on commit bd8b980

Please sign in to comment.