relative_url_root doesn't work correctly with Rails 5.1.4

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

relative_url_root doesn't work correctly with Rails 5.1.4

Takuya Kusumoto
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: relative_url_root doesn't work correctly with Rails 5.1.4

Takuya Kusumoto
I guess asset compile is failing with relative_url_root...
Any bugs reported?

Kusumoto


2017年10月24日火曜日 23時52分25秒 UTC+9 Takuya Kusumoto:
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 <a href="http://config.ru" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fconfig.ru\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGNk21l5vNnkEUuhZ94CbiUdeHNBA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fconfig.ru\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGNk21l5vNnkEUuhZ94CbiUdeHNBA&#39;;return true;">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
<a href="http://localhost:3000/subdir" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A3000%2Fsubdir\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFXhxIMnPKt3shsSkDkCpqjhpqGfg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A3000%2Fsubdir\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFXhxIMnPKt3shsSkDkCpqjhpqGfg&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2c1537a3-570a-4013-81d2-7f3e5502aefe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: relative_url_root doesn't work correctly with Rails 5.1.4

botp
see config.assets.prefix

On Tue, Oct 24, 2017 at 11:01 PM, Takuya Kusumoto <[hidden email]> wrote:
> I guess asset compile is failing with relative_url_root...
> Any bugs reported?

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAAwHHQj%2BwsJXJWgTR9W0i8P7Jqty8fveNTTN_y_AmP2ZXJ9umw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: relative_url_root doesn't work correctly with Rails 5.1.4

Takuya Kusumoto
Thanks. Already tried. But the option changes asset directory under public.
It made the situation worse... (all of assets becomes 404)


2017年10月25日水曜日 0時25分55秒 UTC+9 bot Peña:
see config.assets.prefix

On Tue, Oct 24, 2017 at 11:01 PM, Takuya Kusumoto <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="2T2wKX5vBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">kusu...@...> wrote:
> I guess asset compile is failing with relative_url_root...
> Any bugs reported?

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eba2a8ae-d245-4afa-9db1-87923dd67913%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: relative_url_root doesn't work correctly with Rails 5.1.4

Takuya Kusumoto
Finally solved.
The root cause was config.assets.debug = true in development.rb.
When I commented it, it worked!
The conclusion is config.assets.debug has a bug with relative_url_root.

Thanks,
Kusumoto 


2017年10月25日水曜日 0時45分19秒 UTC+9 Takuya Kusumoto:
Thanks. Already tried. But the option changes asset directory under public.
It made the situation worse... (all of assets becomes 404)


2017年10月25日水曜日 0時25分55秒 UTC+9 bot Peña:
see config.assets.prefix

On Tue, Oct 24, 2017 at 11:01 PM, Takuya Kusumoto <[hidden email]> wrote:
> I guess asset compile is failing with relative_url_root...
> Any bugs reported?

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/11de8905-fecf-4345-9b2c-9d58ef31b58c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.