Skip to content
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

xhr-multipart not proxied #70

Closed
fjakobs opened this issue Jul 8, 2011 · 11 comments
Closed

xhr-multipart not proxied #70

fjakobs opened this issue Jul 8, 2011 · 11 comments

Comments

@fjakobs
Copy link
Contributor

fjakobs commented Jul 8, 2011

I'm, trying to use socket.io's xhr-multipart transport but the connection is always closed after the first chunk of data. Looks like there is a problem with transfer encoding chunked.

@Marak
Copy link
Contributor

Marak commented Jul 8, 2011

Could you provide a test case that reproduces this?

@fjakobs
Copy link
Contributor Author

fjakobs commented Jul 11, 2011

Sure. This is a very basic test with socket.io. https://gist.github.com/1075579

You need to have socket.io 0.6.x and http-proxy in path. Then open the app in Firefox. If you navigate to the socket.io server at http://localhost:6666 you will see the connect message in the console.

If you navigate to the proxied request at http://localhost:6060 the multipart-xhr connection is opened and immediately closed again.

@dominictarr
Copy link
Contributor

hmm, I am unable to reproduce this. It loads okay. but never logs connect

If I point chrome at localhost:6666

I get Error 312 (net::ERR_UNSAFE_PORT): Unknown error.

okay, i'm reproducing this in firefox with socket.io@0.6.0

Can you make a simpler test that does not require a browser or socket.io?

I know some things socket.io does will not work behind a proxy. (like using multiple ports) prehaps this should be posted as a socket.io issue?

@Marak
Copy link
Contributor

Marak commented Jul 18, 2011

The tests currently use: https://github.com/nodejitsu/node-http-proxy/blob/master/vendor/websocket.js as the websocket client.

@dominictarr
Copy link
Contributor

@Marak in @jakobs script he sets socket.io to use xhr-multipart, so socket.io falls back to that instead of websockets.

https://gist.github.com/1075579#L7

@fjakobs
Copy link
Contributor Author

fjakobs commented Jul 18, 2011

I was able to reduce the bug and remove the socket.io dependency https://gist.github.com/1088883.
Note that you have to test this with Firefox because other browsers don't support multipart xhr. I think this exposes some problems with chunked encoding and connection keep-alive.

@dominictarr
Copy link
Contributor

good work.

I can see it work in firefox (note, firebug must be installed - to get console.log)
If you request localhost:6666/xhr (bypass proxy) it works correctly.
If you request localhost:6060/xhr (through proxy) it does not work.

the same behaviour occurs with curl.

I will tag this as confirmed bug, migrate this test to vows, then fix.

thanks @fjakobs, good hunting!

@fjakobs
Copy link
Contributor Author

fjakobs commented Jul 19, 2011

Thanks. Good luck fixing

@dominictarr
Copy link
Contributor

I think this might be a bug in core's handling of keep-alive.

I expanded your gist to request to your keep-alive server. by passing the proxy it still doesn't work. it does not get the response body. However, if you comment out headers['Connection'] = 'keep-alive'; it does work.

here is my gist: https://gist.github.com/1113432

there are lots of issues for keep-alive in node: https://github.com/joyent/node/issues/search?q=keep-alive

@subnetmarco
Copy link
Contributor

Any update on this?

@jcrugzz
Copy link
Contributor

jcrugzz commented Oct 30, 2015

Closing due to old age, this should no longer be an issue

@jcrugzz jcrugzz closed this as completed Oct 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants