Open nielsbom opened 3 months ago
What do you think about tracking and develop the Cloudflare Worker code (worker.js
and any settings) within this repo? We could setup a new folder such as cloudflare-workers
or pmtiles
for this. It would help with working on issues like this as well as make our setup more reproducible for others when this all moves to being a template for other projects.
For keeping them synchronised, there is Wrangler a CLI tool for managing Cloudflare Worker projects.
As this is an issue with the workflow and CI, this could lead to us adding bugs elsewhere without realising it. I'm keen to sort this out soon.
I'll think about it again this week. As @nielsbom points out, CORS doesn't allow dynamic URLs. However, I think we can add it to the code itself.
If anyone has thoughts, please share them!
I also plan on integrating this code into the repository itself as it will make it easier for others to set up community maps.
Previews of branches are deployed at URLs like:
https://deploy-preview-<PR number>--queeringthemap.netlify.app/
To allow sites on those domains to do requests to
https://tiles.queeringthemap.com/basemap/*
we need to configure theALLOWED_ORIGINS
variable of the Cloudflare Worker serving those requests, this is a CORS issue.Putting literal domains (including subdomains) in there works, but would then be necessary for each separate PR (kinda ugly). It might be possible to use a wildcard or regex value but I haven't got that working yet.
This Stack Overflow answer may be of help.