-
-
Notifications
You must be signed in to change notification settings - Fork 729
Support ui.run(cache_control_directives=) #4540
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @evnchn!
I moved the new parameter a few lines up to group it with other durations like the reconnect timeout.
Apart from that I have two open questions:
- The docstrings say "cache control directives for static files". But methods like
app.add_static_files
have a separate max cache age which still defaults to an hour. Therefore I'm searching for a better description. - The middleware matches paths starting with "/nicegui/...". But I'm not 100% sure if this works in combination with a path prefix, like in https://github.com/zauberzeug/nicegui/tree/main/examples/nginx_subpath.
Last but not least, I think we should block this PR until PR #4539 ("Cachebusting") is merged. Changing the cache to one year without handling custom components would cause quite some trouble.
|
Final note: If you want to add this PR before cachebusting PR is merged, then set the default parameter of But I persoanlly don't recommend rushing it. Seems a bad look if we add a parameter only that the default value changes from one version to another in a minor release. |
#4532 (comment)
TL-DR:
cache_control_directives
argument inui.run
andui.run_with
, with default being long 1-year cache*immutable
(not available for Chrome),stale-while-revalidate
(available for Chrome)Concerns:
ui.run
andui.run_with
the best place to add the parameter?Testing: