Skip to content

Allow multiple domains in CORS in pmtiles serve #191

Closed
@t0mk

Description

@t0mk

When serving tiles, it's sometimes useful to whitelist CORS "access" from more than one domain (but not from everywhere). It would be helpful for me if this was possible with pmtiles.

Since response header Access-Control-Allow-Origin only allows to specify one domain name, I think the server code could check Origin header from request, and if it would be one of the whitelisted origins, it would copy it to Access-Control-Allow-Origin in response.

The whitelisted CORS origins could be listed in the --cors argument, just comma-separated. For example:

pmtiles serve ./ --cors="https://mydomain.com,https://otherdomain.com"

I could contribute this. Would you be interested in taking it in?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions