-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
[rest] Add no-cache
directive to cached REST responses
#3970
Conversation
Fixes openhab/openhab-webui#2102. This forces the browser to revalidate the cache every time it is accessed to ensure the data is always fresh. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives. This is approach is also suggested in the mdn web docs, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#up-to-date_contents_always. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Do you know why the |
At the moment, only some of the resources have implemented caching, so obviously only the Resources with caching implement need CacheControl. Would be nice to extend caching, but at the moment we already have covered the most important endpoints used in the UI, and I expect the already existing caching to have much higher effect than for the missing caching. |
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! It makes sense to only cache the most frequently used and biggest responses.
Fixes openhab/openhab-webui#2102. This forces the browser to revalidate the cache every time it is accessed to ensure the data is always fresh. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives. This is approach is also suggested in the mdn web docs, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#up-to-date_contents_always. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/oh4-4-1-gui-doesnt-show-installed-bindings/152413/37 |
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
Fixes openhab/openhab-webui#2102, where Firefox users reported problems with outdated data in Main UI due to Firefox handling caching different than Chromium.
Also reported on the community, e.g. https://community.openhab.org/t/firefox-oh-4-0-1-issues/148633 and https://community.openhab.org/t/updating-widget-code-not-working/148265.
This forces the browser to revalidate the cache every time it is accessed to ensure the data is always fresh. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives.
This is approach is also suggested in the mdn web docs, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#up-to-date_contents_always.
This PR should be backported to 4.1.x.