I faced 404 errors for asset pipeline URLs when I set config.relative_url_root with Rails 5.1.4/
What I did was as follows.
- Put the following lines in development.rb.
ENV[“RAILS_RELATIVE_URL_ROOT”] = “/subdir”
config.relative_url_root = “/subdir”
- Modified config.ru as follows.
map ActionController::Base.config.relative_url_root || “/” do
- Then start rails server
rails server puma -d -b 0.0.0.0
- See the application application page
Some of asset URLs get 404 error and not shown.
Of course, commenting #1 works well.
Could you please advice how to fix this?
Someone, please try to do above as it’s easy to setup…