-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Make deployed_version.txt editor friendly #9338
Conversation
In production environments with a CDN for static files it comes in handy that you can force a browser cache refresh by changing the number manually without having to go into maintenance for a full deploy. If you edit the `pub/static/deployed_version.txt` with vim, nano or `echo '123456789' > pub/static/deployed_version.txt` you can unintentionally create a newline at the end of the file. This will result in: ```html var BASE_URL = 'https://magento2.dev/sitemanager/admin/index/index/key/ec38dd3ded42b71db14166d6bcdfc56d4e7d4b7801b9808373ae4b3563b65513/'; var FORM_KEY = 'dKArsQU6NhimXr6Z'; var require = { "baseUrl": "https://magento2.dev/pub/static/version1492766286 /adminhtml/Magento/backend/en_US" }; ``` With that baseUrl all resources using baseUrl will return the 404 page. Adding a simple `trim()` here will remove that risk.
@ajpevers Isn't it better to add some command/option to the deploy command to refresh the version? |
@ishakhsuvarov I think a option in the deploy command would be best indeed. An extra command would clutter the bin/magento command list I fear. I'll work on a PR with the extra option. Maybe |
@ajpevers Thank you. Looks good to me for now. |
@ajpevers Closing this for now due to inactivity. Please reopen and update this PR or create a new one if you wish to continue. |
With this option you can quickly force a browser cache refresh or a CDN cache refresh without having to generate all static content. This comes in handy especially when you have made no code changes, but the CDN failed to update it's cache the last time you deployed or when you have made a manual change in one of the static files as a hotfix on your deployment server, awaiting a suitable moment for deployment to finalize it. This reopens magento#9338.
…deploy command to refresh the version #9915
Hello @mengbo123456, You do not have to create the versionXXXXXXXXXX folder. Please look at this line in the pub/static/.htaccess file: https://github.com/magento/magento2/blob/develop/pub/static/.htaccess#L16 It rewrites urls like So if one of your files is not found: |
[Hammer][2.4.8-beta2] Platform Health Scope
Description
In production environments with a CDN for static files it comes in handy that you can force a browser cache refresh by changing the number manually without having to go into maintenance for a full deploy.
If you edit the
pub/static/deployed_version.txt
with vim, nano orecho '123456789' > pub/static/deployed_version.txt
you can unintentionally create a newline at the end of the file.This will result in:
With that baseUrl all resources using baseUrl will return the 404 page.
Adding a simple
trim()
here will remove that risk.Manual testing scenarios
pub/static/deployed_version.txt
with vim in a shop that is in production modeContribution checklist