Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set cache-control headers and compression #195

Closed
tanc opened this issue Feb 19, 2021 · 4 comments
Closed

Ability to set cache-control headers and compression #195

tanc opened this issue Feb 19, 2021 · 4 comments
Assignees
Labels
feature New feature
Projects

Comments

@tanc
Copy link
Contributor

tanc commented Feb 19, 2021

At the moment it seems like there is no cache-control header set and the resources are served with no compression (gzip, brotli).

It would be great if Meli had some sane defaults, much like Netlify does, which would make serving static files even more efficient. Then ideally there would be some settings to configure cache headers on a site-by-site basis within the UI (or a config file like Netlify uses).

Netlify set a cache-control header like this:

cache-control: public, max-age=0, must-revalidate

They say that it makes the browser re-check for changes each time but against the etag to see if anything has changed. Supposedly this is very efficient with HTTP2. From what I can tell without a cache-control header my browser is caching the resources served by Meli and when I update the branch with a new release I got inconsistent results. One time I reloaded the page and the css file I'd changed didn't update, then on other releases it did update. Without further testing its hard to say whether setting a cache-control would provide the consistency or hurt performance.

It would be good to see resources gzipped on-the-fly with Caddy, I believe this is the directive: https://caddyserver.com/docs/caddyfile/directives/encode

Thanks for your efforts!

@gempain
Copy link
Contributor

gempain commented Feb 22, 2021

@tanc thanks for the detailed request ! I think it's a great suggestion, we'll add this to the roadmap.

@gempain gempain added the feature New feature label Feb 22, 2021
@gempain gempain changed the title Request: Ability to set cache-control headers and compression Ability to set cache-control headers and compression Feb 23, 2021
@gempain gempain added this to To do in main Mar 9, 2021
@gempain gempain self-assigned this Mar 9, 2021
@gempain gempain moved this from To do to In progress in main Mar 9, 2021
gempain pushed a commit that referenced this issue Mar 9, 2021
gempain pushed a commit that referenced this issue Mar 9, 2021
gempain pushed a commit that referenced this issue Mar 9, 2021
@gempain
Copy link
Contributor

gempain commented Mar 10, 2021

This is implemented in next. Cache headers are now set, and requests are gzipped. We've added the ability to define custom headers at the site level and at per branch. Branch headers will override site headers, and custom headers will override default headers configured by Meli (at the moment, cache control).

gempain pushed a commit that referenced this issue Mar 10, 2021
# [1.0.0-beta.17](v1.0.0-beta.16...v1.0.0-beta.17) (2021-03-10)

### Bug Fixes

* error when unhandled socket event ([3e0151a](3e0151a))
* req.query not typed ([581e3ca](581e3ca))
* socket io protocol error ([6e414a0](6e414a0))
* **add branch:** should not update release when no id given ([b3b25e8](b3b25e8))

### Features

* add websocket handler [#194](#194) ([2aad514](2aad514))
* change api scope formats ([#200](#200)) ([ed34896](ed34896))
* configure gzip compression ([#195](#195)) ([bc5e3ff](bc5e3ff))
* custom headers per branch or site ([#195](#195)) ([c8645a7](c8645a7))
* forbid underscores in site name ([#193](#193)) ([f263f09](f263f09))
* set cache-control header ([#195](#195)) ([09621ea](09621ea))

### BREAKING CHANGES

* all API tokens currently in use will be invalidated.
@tanc
Copy link
Contributor Author

tanc commented Mar 10, 2021

Wow amazing! Will test this out soon

@gempain gempain moved this from In progress to Done in main Mar 10, 2021
@gempain
Copy link
Contributor

gempain commented Mar 10, 2021

This was released on beta. I'm closing, but feel free to comment and we'll reopen if needed.

@gempain gempain closed this as completed Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
main
Done
Development

No branches or pull requests

2 participants