{"html_url": "https://github.com/simonw/datasette/issues/1590#issuecomment-1010533133", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1590", "id": 1010533133, "node_id": "IC_kwDOBm6k_c48O4MN", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-12T01:19:19Z", "updated_at": "2022-01-12T01:19:19Z", "author_association": "OWNER", "body": "Thanks for the steps to reproduce - I have your bug running on my laptop now.\r\n\r\nI've been mostly testing this stuff using the hosted copy of Datasette here, which doesn't exhibit the bug: https://datasette-apache-proxy-demo.fly.dev/prefix/fixtures?sql=select+sqlite_version%28%29\r\n\r\nSomething interesting definitely going on here!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1099723916, "label": "Table+query JSON and CSV links broken when using `base_url` setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1590#issuecomment-1010537058", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1590", "id": 1010537058, "node_id": "IC_kwDOBm6k_c48O5Ji", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-12T01:26:34Z", "updated_at": "2022-01-12T01:26:34Z", "author_association": "OWNER", "body": "I'm using the https://datasette.io/plugins/datasette-debug-asgi plugin to investigate.\r\n\r\nOn my laptop using Daphne I get this: http://127.0.0.1:8032/datasettes/-/asgi-scope\r\n\r\n```\r\n{'actor': None,\r\n 'asgi': {'version': '3.0'},\r\n 'client': ['127.0.0.1', 53767],\r\n 'csrftoken': ._asgi_csrf_decorator..app_wrapped_with_csrf..get_csrftoken at 0x1122aeef0>,\r\n 'headers': [(b'host', b'127.0.0.1:8032'),\r\n (b'user-agent',\r\n b'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:95.0) Gecko'\r\n b'/20100101 Firefox/95.0'),\r\n (b'accept',\r\n b'text/html,application/xhtml+xml,application/xml;q=0.9,image/'\r\n b'avif,image/webp,*/*;q=0.8'),\r\n (b'accept-language', b'en-US,en;q=0.5'),\r\n (b'accept-encoding', b'gzip, deflate'),\r\n (b'dnt', b'1'),\r\n (b'connection', b'keep-alive'),\r\n (b'cookie', b'_ga=GA1.1.742283954.1628542653'),\r\n (b'upgrade-insecure-requests', b'1'),\r\n (b'sec-fetch-dest', b'document'),\r\n (b'sec-fetch-mode', b'navigate'),\r\n (b'sec-fetch-site', b'none'),\r\n (b'sec-fetch-user', b'?1')],\r\n 'http_version': '1.1',\r\n 'method': 'GET',\r\n 'path': '/datasettes/-/asgi-scope',\r\n 'path_remaining': '',\r\n 'query_string': b'',\r\n 'raw_path': b'/datasettes/-/asgi-scope',\r\n 'root_path': '',\r\n 'route_path': '/-/asgi-scope',\r\n 'scheme': 'http',\r\n 'server': ['127.0.0.1', 8032],\r\n 'type': 'http',\r\n 'url_route': {'kwargs': {}}}\r\n```\r\nOn the demo running on Fly (which I just redeployed with that plugin) I get this: https://datasette-apache-proxy-demo.fly.dev/prefix/-/asgi-scope\r\n\r\n```\r\n{'actor': None,\r\n 'asgi': {'spec_version': '2.1', 'version': '3.0'},\r\n 'client': ('86.109.12.167', 0),\r\n 'csrftoken': ._asgi_csrf_decorator..app_wrapped_with_csrf..get_csrftoken at 0x7f4c0413bca0>,\r\n 'headers': [(b'host', b'datasette-apache-proxy-demo.fly.dev'),\r\n (b'user-agent',\r\n b'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:95.0) Gecko'\r\n b'/20100101 Firefox/95.0'),\r\n (b'accept',\r\n b'text/html,application/xhtml+xml,application/xml;q=0.9,image/'\r\n b'avif,image/webp,*/*;q=0.8'),\r\n (b'accept-language', b'en-US,en;q=0.5'),\r\n (b'accept-encoding', b'gzip, deflate, br'),\r\n (b'dnt', b'1'),\r\n (b'x-request-start', b't=1641950740651658'),\r\n (b'sec-fetch-dest', b'document'),\r\n (b'sec-fetch-mode', b'navigate'),\r\n (b'sec-fetch-site', b'none'),\r\n (b'sec-fetch-user', b'?1'),\r\n (b'fly-client-ip', b'24.5.172.176'),\r\n (b'x-forwarded-for',\r\n b'24.5.172.176, 213.188.193.173, 86.109.12.167'),\r\n (b'fly-forwarded-proto', b'https'),\r\n (b'x-forwarded-proto', b'https'),\r\n (b'fly-forwarded-ssl', b'on'),\r\n (b'x-forwarded-ssl', b'on'),\r\n (b'fly-forwarded-port', b'443'),\r\n (b'x-forwarded-port', b'443'),\r\n (b'fly-region', b'sjc'),\r\n (b'fly-request-id', b'01FS5Y805BX43HM94T8XW610KG'),\r\n (b'via', b'2 fly.io'),\r\n (b'fly-dispatch-start', b't=1641950740683198;instance=87f188a2'),\r\n (b'x-forwarded-host', b'datasette-apache-proxy-demo.fly.dev'),\r\n (b'x-forwarded-server', b'localhost'),\r\n (b'connection', b'Keep-Alive')],\r\n 'http_version': '1.1',\r\n 'method': 'GET',\r\n 'path': '/-/asgi-scope',\r\n 'query_string': b'',\r\n 'raw_path': b'/-/asgi-scope',\r\n 'root_path': '',\r\n 'scheme': 'https',\r\n 'server': ('127.0.0.1', 8001),\r\n 'type': 'http',\r\n 'url_route': {'kwargs': {}}}\r\n```\r\n\r\nThe version that works as ` 'raw_path': b'/-/asgi-scope'` - the version that fails has `'raw_path': b'/datasettes/-/asgi-scope'`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1099723916, "label": "Table+query JSON and CSV links broken when using `base_url` setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1590#issuecomment-1010538016", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1590", "id": 1010538016, "node_id": "IC_kwDOBm6k_c48O5Yg", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-12T01:28:19Z", "updated_at": "2022-01-12T01:28:19Z", "author_association": "OWNER", "body": "The Daphne one has this key: `'route_path': '/-/asgi-scope',`\r\n\r\nMaybe Datasette's routing code needs to look out for that, if it's available, and use it to reconstruct the requested path?\r\n\r\nThe code in question is here: https://github.com/simonw/datasette/blob/8c401ee0f054de2f568c3a8302c9223555146407/datasette/app.py#L1143-L1149", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1099723916, "label": "Table+query JSON and CSV links broken when using `base_url` setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1590#issuecomment-1010538188", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1590", "id": 1010538188, "node_id": "IC_kwDOBm6k_c48O5bM", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-12T01:28:41Z", "updated_at": "2022-01-12T01:30:43Z", "author_association": "OWNER", "body": "Oh wait! It looks like `route_path` is something I invented there.\r\n\r\nYup, I added it in https://github.com/simonw/datasette/commit/a63412152518581c6a3d4e142b937e27dabdbfdb - commit message says:\r\n\r\n> - new `route_path` key in `request.scope` storing the path that was used for routing with the `base_url` prefix stripped\r\n\r\nSo actually part of the mystery here is: why does the Fly hosted one NOT have that key?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1099723916, "label": "Table+query JSON and CSV links broken when using `base_url` setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1590#issuecomment-1010540923", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1590", "id": 1010540923, "node_id": "IC_kwDOBm6k_c48O6F7", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-12T01:33:49Z", "updated_at": "2022-01-12T01:33:49Z", "author_association": "OWNER", "body": "Looking closer at the code quoted above, it doesn't modify `path` or `raw_path` at all - ALL it does is add the `route_path` to the scope.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1099723916, "label": "Table+query JSON and CSV links broken when using `base_url` setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1590#issuecomment-1010556333", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1590", "id": 1010556333, "node_id": "IC_kwDOBm6k_c48O92t", "user": {"value": 1001306, "label": "eelkevdbos"}, "created_at": "2022-01-12T02:03:59Z", "updated_at": "2022-01-12T02:03:59Z", "author_association": "NONE", "body": "Thank you for the quick reply! Just a quick observation, I am running this locally without a proxy, whereas your fly example seems to be running behind an apache proxy (if the name is accurate). Can it be that the apache proxy strips the prefix before it passes on the request to the daphne backend?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1099723916, "label": "Table+query JSON and CSV links broken when using `base_url` setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1590#issuecomment-1010559681", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1590", "id": 1010559681, "node_id": "IC_kwDOBm6k_c48O-rB", "user": {"value": 1001306, "label": "eelkevdbos"}, "created_at": "2022-01-12T02:10:20Z", "updated_at": "2022-01-12T02:10:20Z", "author_association": "NONE", "body": "In my example, path matching happens at the application layer (being the Django channels URLRouter). That might be a somewhat exotic solution that would normally be solved by a proxy like Apache or Nginx. However, in my specific use case, this is a \"feature\" enabling me to do simple management of databases and metadata from within a Django admin app instance mapped in that same router.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1099723916, "label": "Table+query JSON and CSV links broken when using `base_url` setting"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1591#issuecomment-1010764036", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1591", "id": 1010764036, "node_id": "IC_kwDOBm6k_c48PwkE", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-12T08:22:16Z", "updated_at": "2022-01-12T08:22:32Z", "author_association": "OWNER", "body": "The challenge here is avoiding clashes. What if a plugin adds an option that I later want to use for a new Datasette core feature? Or what if two plugins define the same option?\r\n\r\nMaybe the solution is to make them use namespaces defined by the plugin name.\r\n\r\nHow about this:\r\n\r\n datasette t.db --plugin-setting datasette-tiddlywiki db t.db\r\n\r\nIt's a bit verbose having an option that itself then takes THREE strings: plugin name, setting name, setting value - but it would work.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1100015398, "label": "Maybe let plugins define custom serve options?"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1591#issuecomment-1010947634", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1591", "id": 1010947634, "node_id": "IC_kwDOBm6k_c48QdYy", "user": {"value": 82988, "label": "psychemedia"}, "created_at": "2022-01-12T11:32:17Z", "updated_at": "2022-01-12T11:32:17Z", "author_association": "CONTRIBUTOR", "body": "Is it possible to parse things like `--ext-{plugin}-{arg} VALUE` ?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1100015398, "label": "Maybe let plugins define custom serve options?"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1592#issuecomment-1011185061", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1592", "id": 1011185061, "node_id": "IC_kwDOBm6k_c48RXWl", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-01-12T15:50:41Z", "updated_at": "2022-01-12T15:50:41Z", "author_association": "OWNER", "body": "Twitter: https://twitter.com/dracos/status/1481290103519592459", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1100499619, "label": "Row pages should show links to foreign keys"}, "performed_via_github_app": null}