html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,issue,performed_via_github_app https://github.com/simonw/datasette/issues/394#issuecomment-603631640,https://api.github.com/repos/simonw/datasette/issues/394,603631640,MDEyOklzc3VlQ29tbWVudDYwMzYzMTY0MA==,9599,2020-03-25T04:19:08Z,2020-03-25T04:19:08Z,OWNER,Shipped in 0.39: https://datasette.readthedocs.io/en/latest/changelog.html#v0-39,"{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-603570972,https://api.github.com/repos/simonw/datasette/issues/394,603570972,MDEyOklzc3VlQ29tbWVudDYwMzU3MDk3Mg==,9599,2020-03-25T00:17:24Z,2020-03-25T00:17:24Z,OWNER,"I got this working as a proxied instance inside Binder, building on @psychemedia's work: https://github.com/simonw/jupyterserverproxy-datasette-demo/issues/1 Now that I've seen it working there I'm going to land the pull request.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-603525339,https://api.github.com/repos/simonw/datasette/issues/394,603525339,MDEyOklzc3VlQ29tbWVudDYwMzUyNTMzOQ==,9599,2020-03-24T21:55:46Z,2020-03-24T22:07:40Z,OWNER,"OK, I have an implementation of this over in the `base-url` branch (see pull request #708) which is passing all of the unit tests. Anyone willing to give it a quick test and see if it works for your particular use-case? You can install it with: pip install https://github.com/simonw/datasette/archive/base-url.zip Then you can run Datasette like this: datasette fixtures.db --config base_url:/new-base/path/here/","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-603509266,https://api.github.com/repos/simonw/datasette/issues/394,603509266,MDEyOklzc3VlQ29tbWVudDYwMzUwOTI2Ng==,9599,2020-03-24T21:16:34Z,2020-03-24T21:16:34Z,OWNER,"Actually I'll teach `DatasetteRouter` since that subclasses `AsgiRouter` but has access to a `datasette` instance (which it can read configuration values from): https://github.com/simonw/datasette/blob/298a899e792ebd0cd82a5f01b613c31f19082e51/datasette/app.py#L750-L753","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-603508785,https://api.github.com/repos/simonw/datasette/issues/394,603508785,MDEyOklzc3VlQ29tbWVudDYwMzUwODc4NQ==,9599,2020-03-24T21:15:28Z,2020-03-24T21:15:28Z,OWNER,"That means I should teach `AsgiRouter` how to handle an optional prefix: https://github.com/simonw/datasette/blob/298a899e792ebd0cd82a5f01b613c31f19082e51/datasette/utils/asgi.py#L81-L93","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-603508356,https://api.github.com/repos/simonw/datasette/issues/394,603508356,MDEyOklzc3VlQ29tbWVudDYwMzUwODM1Ng==,9599,2020-03-24T21:14:31Z,2020-03-24T21:14:31Z,OWNER,"I'm going to assume that whatever is proxying to Datasette leaves the full incoming URL path intact, so I'm going to need to teach the URL routing code to strip off the prefix before processing the incoming request.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-603501719,https://api.github.com/repos/simonw/datasette/issues/394,603501719,MDEyOklzc3VlQ29tbWVudDYwMzUwMTcxOQ==,9599,2020-03-24T20:59:28Z,2020-03-24T20:59:28Z,OWNER,"Here's the line I'm stuck on now: https://github.com/simonw/datasette/blob/298a899e792ebd0cd82a5f01b613c31f19082e51/datasette/views/base.py#L417 Tricky question: do I continue to rebuild URLs based on the incoming `request` (on the assumption that it has been modified to the new thing) or do I expect that I may still see un-prefixed incoming requests and need to change them? If the incoming URL paths contain the prefix, at what point do I drop that so I can run the regular URL matching code?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-602955699,https://api.github.com/repos/simonw/datasette/issues/394,602955699,MDEyOklzc3VlQ29tbWVudDYwMjk1NTY5OQ==,9599,2020-03-24T01:34:06Z,2020-03-24T01:34:15Z,OWNER,"I don't think I'll go with the `` solution purely because it doesn't work with JSON APIs - and there are quite a few places where Datasette APIs return URLs (for things like toggling facets - e.g. `suggested_facets` on https://latest.datasette.io/fixtures/facetable.json?_labels=on&_size=0 ) The good news is that if you look at the templates almost all of the URLs have been generated in Python code: https://github.com/simonw/datasette/blob/a498d0fe6590f9bdbc4faf9e0dd5faeb3b06002c/datasette/templates/table.html - so it shouldn't be too hard to fix in Python. Ideally I'd like to fix this with as few template changes as possible.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-602913427,https://api.github.com/repos/simonw/datasette/issues/394,602913427,MDEyOklzc3VlQ29tbWVudDYwMjkxMzQyNw==,9599,2020-03-23T23:27:44Z,2020-03-23T23:27:44Z,OWNER,Thanks very much @terrycojones - I'll see if I can finish it up from here.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021, https://github.com/simonw/datasette/issues/394#issuecomment-451704724,https://api.github.com/repos/simonw/datasette/issues/394,451704724,MDEyOklzc3VlQ29tbWVudDQ1MTcwNDcyNA==,9599,2019-01-06T00:32:23Z,2019-01-06T00:33:44Z,OWNER,"I found a really nice pattern for writing the unit tests for this (though it would look even nicer with a solution to #395) ```python @pytest.mark.parametrize(""prefix"", [""/prefix/"", ""https://example.com/""]) @pytest.mark.parametrize(""path"", [ ""/"", ""/fixtures"", ""/fixtures/compound_three_primary_keys"", ""/fixtures/compound_three_primary_keys/a,a,a"", ""/fixtures/paginated_view"", ]) def test_url_prefix_config(prefix, path): for client in make_app_client(config={ ""url_prefix"": prefix, }): response = client.get(path) soup = Soup(response.body, ""html.parser"") for a in soup.findAll(""a""): href = a[""href""] if href not in { ""https://github.com/simonw/datasette"", ""https://github.com/simonw/datasette/blob/master/LICENSE"", ""https://github.com/simonw/datasette/blob/master/tests/fixtures.py"", }: assert href.startswith(prefix), (href, a.parent) ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",396212021,