Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick (and uninformed and perhaps misguided) attempt to add a <base> url for hosting datasette at a particular host/URI #652

Closed
wants to merge 2 commits into from

Conversation

terrycojones
Copy link

As usual, I don't really know what I'm doing... so this is just a suggested approach. I've not written tests, I've not run the tests, I don't know if I've missed some absolute URLs that would need to have the leading slash dropped.

BUT, I tested it with --config base_url:http://127.0.0.1:8001/ on the command line and from what little I know about datasette it's at least working in some obvious cases.

My changes are based on what I saw in 8da2db4 (thanks!)

I'm happy to be more thorough on this if you think it's worth pursuing.

Fixes #394 (he said, optimistically).

…url for hosting datasette at a particular host/URI
@@ -126,6 +126,11 @@
False,
"Force URLs in API output to always use https:// protocol",
),
ConfigOption(
"base_url",
"",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the default should be / to try to ensure that the behaviour with this change is in accordance with the way things were. Then the leading slashes that I dropped get put back in by the <base> tag in case you don't specify one in the config. The downside(?) is that your pages always have a base tag. I used to use <base> a lot back in 1995 or so, to host multiple domains/sites on one server, before the advent of the Host header, etc.

@simonw
Copy link
Owner

simonw commented Mar 24, 2020

This has been replaced by #708, which is close to being ready.

@simonw simonw closed this Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

base_url configuration setting
2 participants