{"html_url": "https://github.com/simonw/datasette/issues/1027#issuecomment-709647525", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1027", "id": 709647525, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTY0NzUyNQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:49:51Z", "updated_at": "2020-10-15T23:51:39Z", "author_association": "OWNER", "body": "I'll install Apache on macOS to figure this out using https://formulae.brew.sh/formula/httpd\r\n\r\n`brew install httpd` output this at the end:\r\n\r\n```\r\n==> httpd\r\nDocumentRoot is /usr/local/var/www.\r\n\r\nThe default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in\r\n/usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.\r\n\r\nTo have launchd start httpd now and restart at login:\r\n brew services start httpd\r\nOr, if you don't want/need a background service you can just run:\r\n apachectl start\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 722758132, "label": "Add documentation on serving Datasette behind a proxy using base_url"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1027#issuecomment-709646865", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1027", "id": 709646865, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTY0Njg2NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:47:08Z", "updated_at": "2020-10-15T23:47:08Z", "author_association": "OWNER", "body": "It should cover both nginx and Apache. nginx config is here: https://github.com/simonw/datasette/issues/1024#issuecomment-709598324", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 722758132, "label": "Add documentation on serving Datasette behind a proxy using base_url"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1026#issuecomment-709636372", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1026", "id": 709636372, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzNjM3Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:09:34Z", "updated_at": "2020-10-15T23:09:34Z", "author_association": "OWNER", "body": "I'm inclined to say that internal requests should ignore `base_url` - since that seems like the right thing for plugins that need to access default Datasette APIs.\r\n\r\nThe one catch here is plugins that might want to proxy the current incoming URL for some reason - where that incoming `request.path` could include the `base_url`.\r\n\r\nActually those should be fine - because it will have been stripped off earlier:\r\n\r\nhttps://github.com/simonw/datasette/blob/4f7c0ebd85ccd8c1853d7aa0147628f7c1b749cc/datasette/app.py#L963-L968", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 722738988, "label": "How should datasette.client interact with base_url"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/904#issuecomment-709635276", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/904", "id": 709635276, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzNTI3Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:05:54Z", "updated_at": "2020-10-15T23:05:54Z", "author_association": "OWNER", "body": "Could have `instance_url()` take an optional path argument which is then turned into the correct path.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 663228985, "label": "datasette.urls.table() / .instance() / .database() methods for constructing URLs, also exposed to templates"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/904#issuecomment-709635021", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/904", "id": 709635021, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzNTAyMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:05:11Z", "updated_at": "2020-10-15T23:05:11Z", "author_association": "OWNER", "body": "I think this should be a family of functions:\r\n\r\n- `instance_url()` - the root URL of the instance (usually `/` unless `base_url` is set)\r\n- `database_url(database_name)` - already got this\r\n- `table_url(database_name, table_name)`\r\n- `row_url(database_name, table_name, row)` - not sure about this one. The idea would be for `row` to be correctly turned into a URL by introspecting the primary keys for that table, then pulling those values out of the SQLite `row` object. Might not be necessary though.\r\n\r\nI also need a way for plugins to link to e.g. `/-/configure-fts` - or even `/-/configure-fts/database-name/table-name`. What should that look like?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 663228985, "label": "datasette.urls.table() / .instance() / .database() methods for constructing URLs, also exposed to templates"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/904#issuecomment-709634261", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/904", "id": 709634261, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzNDI2MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:02:43Z", "updated_at": "2020-10-15T23:02:43Z", "author_association": "OWNER", "body": "Here's the current implementation of `database_url` - on the `BaseView` class, but only because it needs access to a `datasette` instance (to read `base_url`):\r\nhttps://github.com/simonw/datasette/blob/8f97b9b58e77f82fef1f10e9c9f6754b993544b6/datasette/views/base.py#L102-L108", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 663228985, "label": "datasette.urls.table() / .instance() / .database() methods for constructing URLs, also exposed to templates"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/904#issuecomment-709633823", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/904", "id": 709633823, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzMzgyMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:01:13Z", "updated_at": "2020-10-15T23:01:13Z", "author_association": "OWNER", "body": "Tracking ticket: #1023", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 663228985, "label": "datasette.urls.table() / .instance() / .database() methods for constructing URLs, also exposed to templates"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/988#issuecomment-709633762", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/988", "id": 709633762, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzMzc2Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T23:01:01Z", "updated_at": "2020-10-15T23:01:01Z", "author_association": "OWNER", "body": "This is a dupe of https://github.com/simonw/datasette/issues/904", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 713209404, "label": "Mechanism for plugins to construct URLs that respect base_url"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/865#issuecomment-709633080", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/865", "id": 709633080, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzMzA4MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T22:58:51Z", "updated_at": "2020-10-15T22:58:51Z", "author_association": "OWNER", "body": "It looks like there are places where Datasette might return a redirect that doesn't take `base_url` into account - I'm planning on fixing those here, after which I think `ProxyPassReverse` should no longer be necessary. https://github.com/simonw/datasette/issues/1025#issuecomment-709632136", "reactions": "{\"total_count\": 1, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 1, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 644582921, "label": "base_url doesn't seem to work when adding criteria and clicking \"apply\""}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/900#issuecomment-709632765", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/900", "id": 709632765, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzMjc2NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T22:57:55Z", "updated_at": "2020-10-15T22:57:55Z", "author_association": "OWNER", "body": "I believe this particular bug has been fixed, based on my testing here: https://github.com/simonw/datasette/issues/1024#issuecomment-709622973\r\n\r\nPlease re-open the ticket if you are still experiencing it.\r\n\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 661605489, "label": "Some links don't honor base_url"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1025#issuecomment-709632314", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1025", "id": 709632314, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzMjMxNA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T22:56:25Z", "updated_at": "2020-10-15T22:56:34Z", "author_association": "OWNER", "body": "That `utils/asgi.py` line is the default path for setting cookies. That should likely take `base_url` into account too:\r\nhttps://github.com/simonw/datasette/blob/4f7c0ebd85ccd8c1853d7aa0147628f7c1b749cc/datasette/utils/asgi.py#L331-L342", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 722724086, "label": "Fix last remaining links to \"/\" that do not respect base_url"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1025#issuecomment-709632136", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1025", "id": 709632136, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYzMjEzNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T22:55:44Z", "updated_at": "2020-10-15T22:55:44Z", "author_association": "OWNER", "body": "It looks like there are also some generated redirect responses that don't take `base_url` into account:\r\n```\r\ndatasette % git grep '\"/' -- '*.py' ':(exclude)*test_*.py' ':(exclude)datasette/app.py'\r\ndatasette/_version.py: for i in cfg.versionfile_source.split(\"/\"):\r\ndatasette/utils/asgi.py: path=\"/\",\r\ndatasette/views/base.py: should_redirect = \"/{}-{}\".format(name, expected)\r\ndatasette/views/base.py: should_redirect += \"/\" + urllib.parse.quote_plus(kwargs[\"table\"])\r\ndatasette/views/base.py: should_redirect += \"/\" + kwargs[\"pk_path\"]\r\ndatasette/views/special.py: response = Response.redirect(\"/\")\r\ndatasette/views/special.py: return Response.redirect(\"/\")\r\ndatasette/views/special.py: response = Response.redirect(\"/\")\r\ndatasette/views/special.py: return Response.redirect(\"/\")\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 722724086, "label": "Fix last remaining links to \"/\" that do not respect base_url"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1025#issuecomment-709629920", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1025", "id": 709629920, "node_id": "MDEyOklzc3VlQ29tbWVudDcwOTYyOTkyMA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-15T22:48:20Z", "updated_at": "2020-10-15T22:48:20Z", "author_association": "OWNER", "body": "Also these:\r\n```\r\ndatasette % git grep '\"/' -- '*.html' ':(exclude)*/patterns.html'\r\ndatasette/templates/allow_debug.html: