Hobo part with relative url breaks

24 views
Skip to first unread message

kevinpfromnm

unread,
Jun 13, 2017, 11:54:19 AM6/13/17
to Hobo Users
Subject pretty much sums it up. I have part updates working in dev, but production is on passenger. To confirm that it's the relative url path breaking it, I configured dev similarly. It looks like the recognized_path call fails to account for the relative path

Ed Gomolka

unread,
Jun 15, 2017, 9:57:48 PM6/15/17
to Hobo Users
I'm not sure if this is related, but I submitted a pull request for a problem that I was having when I tried to locate my Hobo application in a non-root location. Hobo has a variable called page_path returns the full path. It messes things up if you are setting RAILS_RELATIVE_URL_ROOT.

Here is the pull request: https://github.com/Hobo/hobo/pull/194

kevinpfromnm

unread,
Jun 16, 2017, 10:44:18 AM6/16/17
to Hobo Users
This is related. I worked around it by redefining recognize_page_path in the controllers. Probably should be fixed in Rails' recognize_path though really.

Tim Griffin

unread,
Aug 2, 2017, 11:35:27 PM8/2/17
to Hobo Users
Hi Ed;

I sent this to Ignacio and then found your semi-related post, and figured the more eyes the better. I also have an app hosted in a non-root location and (after considerable debugging) discovered a problem in hobo/hobo_route_helper.rb:76 (in Hobo 2.2.6). I wondering if you also think this to be a problem, and related to your issue? 

Here's the line from hobo_route_helper:

if Rails.application.config.action_controller.relative_url_root
  base_url = url.gsub(/^#{Rails.application.config.action_controller.relative_url_root}/, "")
end

In my app, I've set relative_url_root to "/app/lts-test" and and my default_url_options are also set as follows:

         { :host => 'example.com', 
           :protocol => "https", 
           :port => nil, 
           :only_path => false, 
           :script_name => '/app/lts-test' }

Notice that my host is a full URL (which I normal, I guess): example.com

When Hobo calls into its route_helper, though, the regex is set to look for my relative_url_root at the beginning of the string ("gsub(/^#{Rails...."), which fails because at this point my url is actually this:


This means, the "/app/lts-test" part isn't being removed, causing other failures such as this:

recognize_path has failed: No route matches "https://example.com/app/lts-test/user/1/edit"

I tried switching my default_url_options to be :only_path => true which partly solves the problem, but then causes trouble with other routes that expect a full path, even ones that within Hobo that I've not overridden. 

So, does this strike you as an error? Why would the relative_url_root be searched for only at the beginning of the string? It seems to make more sense to remove it from anywhere in the entire url string. 

Your thoughts? 
Tim


Ed Gomolka

unread,
Aug 4, 2017, 12:00:30 PM8/4/17
to Hobo Users
Hi Tim:
I think that this is the same problem.
It is caused by the way that Hobo uses the request path. I made a change in hobo_rapid_helper.rb to resolve the issue.
Here is my pull request with the commit info: https://github.com/Hobo/hobo/pull/194/commits/b4376d5b62eef3a41e77d632429527a3d04d9371

Ed

Owen Sotomayor

unread,
Nov 4, 2017, 12:30:27 PM11/4/17
to Hobo Users
Reply all
Reply to author
Forward
0 new messages