-
-
Notifications
You must be signed in to change notification settings - Fork 772
URL hashing now optional: turn on with --config hash_urls:1 (#418) #416
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
Conversation
Deployed a demo: https://datasette-optional-hash-demo.now.sh/
|
Still TODO: need to figure out what to do about cache TTL. Defaulting to 365 days no longer makes sense without the hash_urls setting. Maybe drop that setting default to 0? Here's the setting: Lines 84 to 86 in 9743e1d
And here's where it takes affect: datasette/datasette/views/base.py Lines 491 to 501 in 4462a5a
|
Also: if the option is False and the user visits a URL with a hash in it, should we redirect them? I'm inclined to say no: furthermore, I'd be OK continuing to serve a far-future cache header for that case. |
This also needs extensive tests to ensure that with the option turned on all of the redirects behave as they should. |
See #418 |
a line of sql added to create the idx_<table_name> in the python recipe
I'm going to introduce a new config setting: |
The code for this has got a bit tricky. I need to make a decision at some point as to if the current request is a hashed_url request (if it includes a DB hash in the URL which is the current correct hash). I then need to be able to use that fact to decide which default TTL value to apply when returning the response. |
Since this feature is now controlled by a config setting, I'm inclined to make it also available via a URL parameter. If you hit this URL:
We can redirect to:
In this way developers can opt-in to a hashed (and hence far-future cached) response on a per-query basis. This option won't be available against mutable databases though, which are coming in #419 This means that the |
No description provided.