xhr-multipart not proxied #70

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

Comments

Projects
None yet
5 participants
@fjakobs
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

This comment has been minimized.

Show comment Hide comment
@Marak

Marak Jul 8, 2011

Contributor

Could you provide a test case that reproduces this?

Contributor

Marak commented Jul 8, 2011

Could you provide a test case that reproduces this?

@fjakobs

This comment has been minimized.

Show comment Hide comment
@fjakobs

fjakobs Jul 11, 2011

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment Hide comment
@dominictarr

dominictarr Jul 17, 2011

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?

Contributor

dominictarr commented Jul 17, 2011

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

This comment has been minimized.

Show comment Hide comment
@Marak

Marak Jul 18, 2011

Contributor

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

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

This comment has been minimized.

Show comment Hide comment
@dominictarr

dominictarr Jul 18, 2011

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

Contributor

dominictarr commented Jul 18, 2011

@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

This comment has been minimized.

Show comment Hide comment
@fjakobs

fjakobs Jul 18, 2011

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment Hide comment
@dominictarr

dominictarr Jul 18, 2011

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!

Contributor

dominictarr commented Jul 18, 2011

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

This comment has been minimized.

Show comment Hide comment
@fjakobs

fjakobs Jul 19, 2011

Contributor

Thanks. Good luck fixing

Contributor

fjakobs commented Jul 19, 2011

Thanks. Good luck fixing

@dominictarr

This comment has been minimized.

Show comment Hide comment
@dominictarr

dominictarr Jul 29, 2011

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

Contributor

dominictarr commented Jul 29, 2011

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

@thefosk

This comment has been minimized.

Show comment Hide comment
@thefosk

thefosk Sep 8, 2012

Contributor

Any update on this?

Contributor

thefosk commented Sep 8, 2012

Any update on this?

@jcrugzz

This comment has been minimized.

Show comment Hide comment
@jcrugzz

jcrugzz Oct 30, 2015

Member

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

Member

jcrugzz commented Oct 30, 2015

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

@jcrugzz jcrugzz closed this Oct 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment