Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Problem with network path references (//host.com/uri/scheme) #3856

Closed
Overbryd opened this Issue · 1 comment

2 participants

@Overbryd

Hello,

I file this issue because I do not know the reason why Rails doesn't respect network path references that are defined in RFC3986 Section 4.2.

Example //asset.host.com/resources/12345

There is also a good StackOverflow discussion about those URLs.
We use this url scheme to build protocol agnostic urls that just work for both http and https. Since in our special case we cannot reliably determine if https is used, we prefer this way.
The second reason is that we avoid all mixed content warnings, if https is used and resources from our application are being referenced.

But it fails when I use Rails' redirect_to method. The reason is clear, because only protocol specific urls are being recognized by the redirect_to method internals

If we want to redirect_to "//asset.host.com/resources/12345" Rails redirects to http://application.host.com//asset.host.com/resources/12345.

Now I'm only some keystrokes away from fixing this problem in the Rails core, but before I start I'd like to know why Rails works this way. Is there a specific reason for this behaviour?

@Overbryd Overbryd referenced this issue from a commit in Overbryd/rails
@Overbryd Overbryd Fix for redirect_to to respect urls with a network path reference lik…
…e "//asset.host.com/resources/1235" see issue #3856
e31c4ac
@Overbryd Overbryd referenced this issue from a commit in Overbryd/rails
@Overbryd Overbryd Fix for redirect_to to respect urls with a network path reference lik…
…e "//asset.host.com/resources/1235" see issue #3856
7dcfe05
@arunagw
Collaborator

@Overbryd closing this as PR already merged. Right ??

@arunagw arunagw closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.