Skip to main content

Datasette plugin for configuring CORS headers

Project description


PyPI CircleCI License

Datasette plugin for configuring CORS headers, based on

You can use this plugin to allow JavaScript running on a whitelisted set of domains to make fetch() calls to the JSON API provided by your Datasette instance.


pip install datasette-cors


You need to add some configuration to your Datasette metadata.json file for this plugin to take effect.

To whitelist specific domains, use this:

    "plugins": {
        "datasette-cors": {
            "hosts": [""]

You can also whitelist patterns like this:

    "plugins": {
        "datasette-cors": {
            "host_wildcards": ["https://*"]

Testing it

To test this plugin out, run it locally by saving one of the above examples as metadata.json and running this:

$ datasette --memory -m metadata.json

Now visit in your browser, open the browser developer console and paste in the following:

fetch("").then(r => r.json()).then(console.log)

If the plugin is running correctly, you will see the JSON response output to the console.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

datasette_cors-0.3-py3-none-any.whl (6.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page