{"html_url": "https://github.com/simonw/datasette/issues/454#issuecomment-489420385", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/454", "id": 489420385, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4OTQyMDM4NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-05-05T12:07:56Z", "updated_at": "2019-05-05T12:10:13Z", "author_association": "OWNER", "body": "Since I want the option to store more than one host, I don't think this should be a command-line option or a `--config` setting. Instead, I'm inclined to add this to `metadata.json`.\r\n\r\nMaybe this should be a plugin? That way the `metadata.json` setting could look like this:\r\n```\r\n{\r\n \"title\": \"Title of this instance\",\r\n \"plugins\": {\r\n \"datasette-cors\": {\r\n \"allowed_origins\": [\"https://example.com\"]\r\n }\r\n }\r\n}\r\n```\r\n\r\nThis could be implemented easily on top of ASGI #272.\r\n\r\n(It should probably raise an exception on startup if any of the `allowed_origins` ends with a slash e.g. `\"https://example.com/\"` since that's not actually a valid origin, and it's an easy mistake to make.)", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 440437037, "label": "Plugin for allowing CORS from specified hosts"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/454#issuecomment-489420661", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/454", "id": 489420661, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4OTQyMDY2MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-05-05T12:11:01Z", "updated_at": "2019-05-05T12:11:01Z", "author_association": "OWNER", "body": "Also worth considering: `Access-Control-Max-Age: 86400` support - maybe as a `\"max_age\"` setting for the plugin. This can reduce the number of preflight checks the browser needs to make.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 440437037, "label": "Plugin for allowing CORS from specified hosts"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/453#issuecomment-489421634", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/453", "id": 489421634, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4OTQyMTYzNA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-05-05T12:24:24Z", "updated_at": "2019-05-05T12:24:24Z", "author_association": "OWNER", "body": "Demo: https://latest.datasette.io/fixtures.json?sql=select+blah\r\n\r\n\"Mozilla_Firefox\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 440332621, "label": "Error pages do not return CORS header with --cors"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/454#issuecomment-489433651", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/454", "id": 489433651, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4OTQzMzY1MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-05-05T14:52:46Z", "updated_at": "2019-05-05T14:52:46Z", "author_association": "OWNER", "body": "I really like the idea of this as a plugin, because it will provide a great example of an ASGI plugin including how to build unit tests against Datasette plugins which actually start up a Datasette server and run some requests through it.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 440437037, "label": "Plugin for allowing CORS from specified hosts"}, "performed_via_github_app": null}