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

custom response headers for tiles #189

Open
thorsteinssonh opened this issue Jan 31, 2025 · 2 comments
Open

custom response headers for tiles #189

thorsteinssonh opened this issue Jan 31, 2025 · 2 comments

Comments

@thorsteinssonh
Copy link

Cache-Control and other tile response headers are configured in a reverse proxy, however I feel like it would be a great addition as a run-time argument. Unless there is a reason you want to avoid this cli option, I'd be willing to create a PR including this.

It is especially useful I think for running the service on AWS ECS with an ALB, without having to fire up a proxy or to use cloud front and other extra configurations.

perhaps the option would be something like this --add-tile-response-headers=some_yaml_file ?

@brendan-ward
Copy link
Collaborator

I'm not keen on adding parsing of an additional file, nor of adding a bunch of CLI options to set individual headers. But I appreciate wanting to run mbtileserver without a reverse proxy in front.

Are there sensible defaults we can set in all cases? I wonder if we're able to set reasonable default values and then users can override those in their reverse proxy as needed if they have special cases that we can't handle in general.

We also have an outstanding issue regarding timestamp headers in #183, so it seems we are overdue for revisiting handling of headers.

@thorsteinssonh
Copy link
Author

thorsteinssonh commented Feb 3, 2025

Thanks, yes, I suppose one hour is probably a very reasonable default. It would be just enough to reasonably cover most map page visits yet allow any updates of mbtiles to drop in fairly soon. Most scenarios I imagine people are not updating their tiles very frequently. I would guess most people running tiles do not update them except every few weeks, but I bet there are exceptions.

A reasonable default sounds like a good idea in any case. Would immediately greatly reduce bandwidth on the vanilla service in production, and people can then configure their edge cases as you said via proxy or other tools.

Perhaps a much easier alternative to parsing a header file would be an option specifying this TTL value only for the cache-control. --cache-control=.... or other, but as you say it is a bit of a bloat perhaps in arguments to the cli. A good default sound perfectly good to me - majority of cases people will want a conservative TTL on the tiles to reduce redundant bandwidth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants