Ruby on Rails Tuesday, October 24, 2017

Hello.

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.

1. Put the following lines in development.rb.
ENV["RAILS_RELATIVE_URL_ROOT"] = "/subdir"
config.relative_url_root = "/subdir"

2. Modified config.ru as follows.
map ActionController::Base.config.relative_url_root || "/" do
  run Rails.application
end

3. Then start rails server
rails server puma -d -b 0.0.0.0

4. See the application application page
http://localhost:3000/subdir

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...

Thanks,
Kusumoto

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a63e8086-c61a-4ed7-bfce-ee15c776ef7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment