-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RequestURI path is modified when path has multiple /
characters
#60
Comments
We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/80170710. |
I think this test duplicates the issue in proxy_test.go:
Returns a 400 Status Code instead of 200 from the proxy server. |
According to rfc3986, an absolute path begins with / but must not '//'. The 400 is a valid response to a request the is invalid. The failure occurs when the path is parsed as a valid url.ParseRequestURI inside request.go |
Thanks for responding @fraenkel I agree that Perhaps I'll have to muddle my way through creating a better unit test to show that the url is getting munged. |
@fraenkel This is hopefully a better test that shows the router is modifying paths that start with
|
For kicks, I tried a few other servers to see what happens with your //test_path request. 404 Not Found: Requested route ('test_path') does not exist. // is not valid period, and there are many translations to make it valid all of which change what is there. Gorouter is actually not doing anything but the underlying golang http server is doing all the munging that is being passed through. If any change is to be made its in the core golang code. |
@fraenkel Hmm....can you confirm you are seeing the same test results as me? When I run that test I get the following failure:
You think that it is correct that the path is changing from |
@fraenkel I re-read your comment: Let me give you background on this issue. We are trying to deploy a thirdparty commercial product to Cloud Foundry. This commercial product has a compiled thick client with a "bug" in it that sends all it's rest requests with Hopefully that background helps. |
Here is another test case going against the loggregator log produced by the router. I don't see how the back end server could be changing the url the router is logging, right?
To be clear. This is the output I get when this test fails:
|
@youngm We would be fine to take a PR on this if you wouldn't mind working on it. |
@dieucao This is one of those hard ones I was hoping you guys could do. :) But, I can see it isn't a priority for you so I'll take a look. Hopefully it doesn't involve rewriting all the golang http server libraries. Thanks, |
Well, I found the problem code: http://golang.org/src/pkg/net/url/url.go#692 In all other ways it appears that the Opaque variable is truly Opaque in every way except in this one way. And I can see no way to supply a truly Opaque path to request.go without completely rewriting the request package. Why is URL not an interface? I hate go lang. :) |
Sounds fair. I looked into it and it is not worth the effort for me to lobby golang for a fix.
You can close the issue if you wish. At the very least perhaps you can keep this issue in mind next time the router is up for a rewrite. Mike |
We have no plans to resolve this issue at this point. We will leave the issue open as a KB for others running into this issue. |
Related golang issue golang/go#10433 |
* cloudfoundry/gorouter#60 * golang/go#10433 If baseurl does not have a trailing `/`, it is added: * https://github.com/spf13/hugo/blob/6af9d6789edef483cd297978e010b40117ff1443/commands/hugo.go#L209-L211 * https://github.com/spf13/hugo/blob/6af9d6789edef483cd297978e010b40117ff1443/commands/server.go#L89 * https://github.com/spf13/hugo/blob/6af9d6789edef483cd297978e010b40117ff1443/commands/server.go#L161-L163 So each `/` after baseurl is actually not needed.
golang/go#10433 says this was fixed in golang 1.5. gorouter has been updated to golang 1.5.3 in cf-release v230. @youngm could you try v230 and see if the upgrade addresses this issue? |
@shalako Yes we'll probably be upgrading to v230+ in 3 weeks or so. I'll test it then. If you want to close this now I can reopen if it is still not fixed. |
According to a comment in golang/go#10433:
I bypassed the ELB and opened a telnet session directly with gorouter so I could specify the absoluteURI.
Corresponding logs for these were:
Let me know if this sounds like a reasonable validation. |
@shalako I finally got around to validating this and it is not fixed. It appears you had a small error in your test case. Instead of putting the entire url in the first line of the request you should have only put the path and then added a host header for the host. The good news is the problem can be duplicated with curl. With the exception of bypassing the ELB I guess you can update your hosts file for the test if you'd prefer to use curl and by pass the ELB. Regardless I've updated your test cases below with the results I see with 231:
Outputs in loggregator:
|
Thank you for taking a closer look. I redid my test using the relative requestURI as you suggested.
I see in the logs that Also, I see similar behavior when going through the ELB:
It appears |
We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/115531505. |
Using RawPath in URL in place of Opaque solves the issues with double (multiple) slashes but fails for absolute URI (https://github.com/cloudfoundry/gorouter/blob/master/proxy/proxy_test.go#L233) and reserved characters (https://github.com/cloudfoundry/gorouter/blob/master/proxy/proxy_test.go#L890). We are not sure we want to break other usecases to support this case. Regards, |
@shashwathi @atulkc Understandable and I agree. So, do we put this back into the golang bug tracker and continue waiting? |
@youngm Yes, I think we should wait on golang fix for this one. Do you want to close this issue or keep it open for tracking? |
@atulkc I'd like to keep it open. Have you submitted a golang bug for this? |
This is the issue on Golang that specified this behavior in 2013: golang/go#4860 We submitted issue golang/go#14952 to the golang repo. |
Looks great. Thanks @crhino |
@youngm Looking at latest comments in golang/go#14952, I would opt for the switch strategy, rather than writing an alternate version of gorouter. Consider that even if @bradfitz takes this feature on, I expect it wouldn't be available until golang 1.7, so this doesn't appear to be a near-term solution. |
@shalako I agree. My hunch is that a switch strategy is extremely unlikely for golang anytime in the future let alone the next couple of versions unless your team can make a really good case for one. :) That said, I hope that this limitation and perhaps other missing features like HTTP/2, persistent connections, higher layer support for more protocols than http, more commonality with tcp routing, etc. might eventually make for enough reasons rewrite all of gorouter's as a Do you see any possibility of something like that happening in the nearish to mid term future? |
I don't believe we have any plans to rewrite gorouter anytime soon. Using the I have received requests for HTTP/2 support, and will be taking a closer look when we upgrade to golang 1.6. However, there are some issues with golang's implementation as I recall. For protocols other than http, we'll be offering TCP routing. This is lower-level support, however. There has been a lot of interest in support for specific UDP protocols, and rather than stuff this all into one component, our current strategy will be to enable a "bring your own router" workflow (exposing Routing API as a multi-tenant service). This could also support routers supporting higher-layer TCP protocols. Except for this one, I don't currently have use cases for turning gorouter into a something which is not http-specific. I would love to hear what you're imagining. Thank you! |
@shalako I was under the impression from conversations with others in the past that making the gorouter a replaceable component wasn't something CF was interested in considering. If the thought is that you want to keep gorouter relatively light and press more specialized load balancing features towards thirdparty ELBs then I agree that building a I whole heatedly agree that a "bring your own router" approach is an excellent long term strategic approach to take for this issue and ones that may popup like it. I'd be fine if you want to close this issue for now. If the situation changes we can reopen. |
We are running cf-release 183.
It appears that the gorouter is modifying the Request Path of a request if prefixed with multiple '/' characters.
Example Request: http://test.app.com/bob
Router Log in Loggregator:
GET /bob HTTP/1.1" 404 15
Example Request: http://test.app.com//bob (node the
//
)Router Log in Loggregator:
GET http://bob HTTP/1.1
Note the addition of "http:" to the request path. This is what I'd expect to see:
Router Log in Loggregator:
GET //bob HTTP/1.1
I would expect the go router to pass this path to the server unchanged.
You can see similar behaviour on pws. Though something appears to be stripping one of the slashes as you only get an error with 3
///
.Example pws Request:
http://boshartifacts.cloudfoundry.org///joe
WEBrick response:
Bad Request bad URI
http://joe'.`The text was updated successfully, but these errors were encountered: