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

Feature question: strip prefix #457

Closed
aapeliv opened this issue Sep 18, 2024 · 4 comments
Closed

Feature question: strip prefix #457

aapeliv opened this issue Sep 18, 2024 · 4 comments

Comments

@aapeliv
Copy link
Contributor

aapeliv commented Sep 18, 2024

Context: we serve a bunch of stuff from Cloudfront. I'd like to deploy static map tiles under a sub-path like /maps/tiles/ like https://cdn.example.com/maps/tiles/20240918/1/0/1.mvt. However, at the moment the serverless function doesn't allow doing things (I think I could rename my PMTiles file to maps/tiles/20240918.pmtiles in the bucket?).

I am probably going to hack in a feature to strip the prefix /maps/tiles into a fork based on an env var, but wondering if there is interest in accepting a PR for it and what that would entail?

@aapeliv
Copy link
Contributor Author

aapeliv commented Sep 18, 2024

I've sorted out what I need to do by adding an env var that lets you just set the PMTiles path to whatever: 1fa5ebe. Obviously only works if you have that path serving a single file.

Also, unrelated, but thank you for this awesome project! It was also super easy to build this function and hack on it, I'm impressed by that too!

@bdon
Copy link
Member

bdon commented Sep 19, 2024

However, at the moment the serverless function doesn't allow doing things (I think I could rename my PMTiles file to maps/tiles/20240918.pmtiles in the bucket?)

Yes, this is the intended solution. Prefix your object keys with the prefix you want.

Obviously only works if you have that path serving a single file.

That could work in your fork but isn't a general-purpose solution. There is an existing PMTILES_PATH which does kind of the opposite of what you want: if you already have a bucket structured with the prefixes /mytiles/abc.pmtiles, setting PMTILES_PATH to /mytiles/{name}.pmtiles will let the requests to /abc fetch from that archive.

@bdon
Copy link
Member

bdon commented Sep 23, 2024

@aapeliv is re-organizing the objects in your bucket to match your desired URL layout a sufficient solution?

I thought a bit about how to configure a prefix-based PMTILES_PATH but we would need to extend it to be a regular expression or something similar to how nginx rewrite rules work. That seems too complex for limited gain, so I'm going to close this issue as non-actionable. Let me know if you have other ideas or your bucket situation isn't compatible with the above.

@bdon bdon closed this as completed Sep 23, 2024
@aapeliv
Copy link
Contributor Author

aapeliv commented Sep 23, 2024

Hey @bdon, yes what I’ve good currently is more than satisfactory for my use case!

Yes I agree that it’s not clear how to do it in a sensible way in general, especially since I seem to be one of very few looking for this kind of feature!

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