if using relative_url_root it seems it should be defined in config/application.rb
Not sure if this is a bug, but it seems odd.
In config/environments/development.rb I have:
config.relative_url_root = '/myurl'
Sometime after config/application.rb runs, but BEFORE config/environments/development.rb Rails runs RouteSet::Initialize (lines 374-390 in action_dispatch/routing/route_set.rb) .
The RouteSet::initialize method sets up an instance variable @config and at this point relative_url_root is nil because it is defined in config/environments/developer.rb which has NOT been called yet.
This means that any gem or rails code that calls the method RouteSet::relative_url_root (lines 398-400) will get nil for relative_url_root even though it is defined in config/environments/developer.rb
I noticed this when using the gem devise_cas_authenticatable which has to build up a service url to return to my app after going out to the CAS server for authentication. The code in devise_cas_authenticatable ultimately ends up calling RouteSet::relative_url_root and gets nil which means the service url it builds is incorrect.
Everything else works as expected in that all my generated routes have myurl/ prepended to them EXCEPT for the service_url created by devise_cas_authenticatable (DCA) but DCA calls out to rails ActionDispatch::Routing::RoutesProxy which calls ActionDispatch::RouteSet::NamedRouteCollection::URlHelper, which ultimately calls ActionDispatch::RouteSet::url_for....yada yada...ActionDispatch::RouteSet::relative_url_root which returns nil
Easy workaround is to define relative_url_root in config/application.rb but I don't see this mentioned anywhere in the guides and this seems like subtle bug.