-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
DO NOT MERGE 4.0.5: Management UI: serve all static assets with a control-cache header (backport #12749) #12779
Open
mergify
wants to merge
3
commits into
v4.0.x
Choose a base branch
from
mergify/bp/v4.0.x/pr-12749
base: v4.0.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cherry picked from commit ce760c6) # Conflicts: # .github/workflows/test-management-ui-for-pr.yaml # deps/rabbitmq_management/test/rabbit_mgmt_http_SUITE.erl # selenium/test/multi-oauth/certs/server_rabbitmq_certificate.pem # selenium/test/multi-oauth/certs/server_rabbitmq_key.pem # selenium/test/multi-oauth/devkeycloak/server_devkeycloak.p12 # selenium/test/multi-oauth/devkeycloak/server_devkeycloak_certificate.pem # selenium/test/multi-oauth/devkeycloak/server_devkeycloak_key.pem # selenium/test/multi-oauth/prodkeycloak/server_prodkeycloak.p12 # selenium/test/multi-oauth/prodkeycloak/server_prodkeycloak_certificate.pem # selenium/test/multi-oauth/prodkeycloak/server_prodkeycloak_key.pem
(cherry picked from commit 50a316a)
rabbit:product_version/0 should not return an 'undefined'. However, a fallback to the base version is a technique we already use in 'rabbitmq-diagnostics status', so adopt the same trick. (cherry picked from commit f5a8388)
Cherry-pick of ce760c6 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
michaelklishin
changed the title
Management UI: serve all static assets with a control-cache header (backport #12749)
DO NOT MERGE 4.0.5: Management UI: serve all static assets with a control-cache header (backport #12749)
Nov 21, 2024
This will have to wait until |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addreses an issue that occurs in production every time RabbitMQ releases a new version which modifies a web resource, i..e, the index.html page, or javascript file or css file. Users have to clear their cache in order to get the management ui to work again.
Proposed Changes
Add response's header that tells the browser to always check whether a web resource has been modified (using eTag) before delivering to the user. In addition to adding the corresponding
control-cache
headers, it is necessary to add some logic to theindex.html
so that it checks if its eTag has changed. This is something the browser does when the user requests a web resource. However,index.html
is a special case compared to other web resources because once the user navigates for the first time to the management ui, it actually never leaves it. This is because this is a SinglePageApplication. Even when the user is kicked out of its session, the browser does not change the web resource, it is still theindex.html
. When the user logs back in, it is still the sameindex.html
. All the management ui is doing is dynamically changing its content. Hence, the browser never checks its eTag with the rabbitmq server.With this change, every time the user logs in, the management ui ensures the version running in the ui matches the version running in the server and if they do not match, it reloads the index.html and with it and thanks to the eTag in all the web resources (javascript and css files), it loads all the latest files into the browser.
This means that if the user has a live session and RabbitMQ is redeployed with a newer version, the user would have logout. In all other cases, the reload is totally transparent to the user.
Context:
Acceptance Test
Reminder: Never refresh the page or modify the url in the browser once you enter it for the first time.
/tmp/rabbitmq.conf
with the following configuration:deps/rabbitmq_management/priv/www/index.html
and modify<title>RabbitMQ Management</title>
to<title>1. RabbitMQ Management</title>
deps/rabbitmq_management/priv/www/js/global.js
and add the following line to the bottom of the filedeps/rabbitmq_management/priv/www/css/main.css
and add the following line to the bottom of the file/tmp/rabbitmq.conf
and uncomment the line#product.version = 4.1.0+beta.1.22.fake.1
make run-broker RABBITMQ_CONFIG_FILE=/tmp/rabbitmq.conf
1. RabbitMQ Management
main.css
andglobal.js
If you repeat these steps on
main
branch, make sure you clear your cache first. You will see that on step 13, the title has not changed.This is an automatic backport of pull request #12749 done by Mergify.