Skip to content
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

Add support for asset host #118

Merged
merged 1 commit into from
Mar 4, 2023
Merged

Add support for asset host #118

merged 1 commit into from
Mar 4, 2023

Conversation

brenogazzola
Copy link
Collaborator

Closes #104

I'll leave this unmerged for now so others can test and give suggestions

@dhh
Copy link
Member

dhh commented Dec 16, 2022

I'm not sure why this is actually still needed? If we're outputting relative URLs, wouldn't those be relative to wherever the CSS is already being served from?

@brenogazzola
Copy link
Collaborator Author

This was requested for users whose assets are not in the app's domain, but other domains, like S3.

This is usually used by apps that perform rolling releases and have a lot of servers. For example, if you change application.js and a user refreshes a page, the HTML request might go to server web1 which has been updated and will point to application_new.js, but the JS request might go to server web13 which has not been updated yet (because the rolling release is still on server web8) and therefore does not have that file, only application_old.js. This will cause a 404. Less of a problem with images, large problem with application.js in an SPA.

@brenogazzola
Copy link
Collaborator Author

If you configure your app's asset_host to point to your CDN and upload the new assets to there before you start a rolling release, the problem is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rails asset_host config is not respected by CssAssetUrls compiler
2 participants