Bug in AbstractRequest.path()?

ActionController::Routes.recognize() to obtain a URI for matching.

If ActionController::AbstractReqeust:;relative_url_root is non-zero
then the AbstractRequest::path chops that many characters off the
URI before returning the new URI.

The problem is that this chopping happens whether or not the URI begins
the relative URL.

I would expect the method to test whether the incoming URI really begins
with the relative URL root before removing that many characters…

Anyhow, the check should happen in line 5:

1 def path
2 path = (uri = request_uri) ? uri.split(’?’).first : ‘’
4 # Cut off the path to the installation directory if given
5 root = relative_url_root
6 path[0, root.length] = ‘’ if root
7 path || ‘’
8 end

I’ve solved my original problem, now that I understand what’s happening
Routes. But the behavior made putting multiple rails apps behind a
reverse proxy a challenge at first. Now that I’ve gotten my
sections working I realize I could have used multiple
to perform the mapping, and not had to worry about using a
at all…

But still, I think the behavior of AbstractRequest::path is broken.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs