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

Add Cloudflare Worker for serving tiles from PMTiles archives in R2 #27

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jake-low
Copy link
Collaborator

Adapted from Brandon's example code here, with per-IP and per-Origin rate limiting added. I tested both rate limiting behaviors (manually lowering the rate limits so they were easier to trigger) and verified that they work.

Deployment instructions are in the README; basically npm run deploy to ship code changes.

@jake-low jake-low requested a review from quincylvania January 22, 2025 02:13
@quincylvania
Copy link
Member

Cool! Thanks for working on this. I think the one thing missing is a whitelist of known origins that we don't rate limit (e.g. americanamap.org, openstreetmap.us). Also, what happens if the requester doesn't set an origin?

@jake-low
Copy link
Collaborator Author

Good point re: a list of pre-approved origins; I'll work on adding that soon.

Also, what happens if the requester doesn't set an origin?

Requests that don't have an Origin header will be rate-limited together in one bucket, since if the header is not present we use a fixed string (the empty string) as the rate limit key.

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

Successfully merging this pull request may close these issues.

2 participants