-
-
Notifications
You must be signed in to change notification settings - Fork 813
Closed
Milestone
Description
I've identified a couple of use-cases for running Datasette in a way that over-rides the default way that internal URLs are generated.
- Running behind a reverse proxy. I tried running Datasette behind a proxy and found that some of the generated internal links incorrectly referenced
http://127.0.0.1:8001/fixtures/...- when they should have been referencinghttp://my-host.my-domain.com/fixtures/...- this is a problem both for links within the HTML interface but also for thetoggle_urlkeys returned in the JSON as part of the facets datastructure. - I would like it to be possible to host a Datasette instance at e.g.
https://www.mynewspaper.com/interactives/2018/election-results/- either through careful HTTP proxying or, once Datasette has been ported to ASGI, by mounting a Datasette ASGI instance deep within an existing set of URL routes.
I'm going to add a url_prefix configuration option. This will default to "", which means Datasette will behave as it does at the moment - it will use / for most URL prefixes in the HTML version, and an absolute URL derived from the incoming Host header for URLs that are returned as part of the JSON output.
If url_prefix is set to another value (either a full URL or a path) then this path will be appended to all generated URLs.
Reactions are currently unavailable