Proxies and Node.js (Squid and socket.io)

2,170 views
Skip to first unread message

s0urce

unread,
Jan 27, 2012, 8:06:46 AM1/27/12
to nodejs
Hi there, i am trying to run a productive Node.js with socket.io. I
planned to run node with socket.io on port 80 or 443 to avoid firewall
port blocks. But now i am faced to a new "enemy" :)
-> Squid (a proxy)
Squid for special or maybe other proxies too, seem to check data
packages send though port 80 and block them, if they are no real http
requests. This makes it impossible to run websocket connection on this
port. If i try to use port 443 wich is normaly crypted, Squid not
check packages, but blocks if there is no openssl. If i add ssl cert,
i can't use in some browser (some told me chrome) cause this browsers
block mixed connection from htttp and https at the same time.

Got anyone any solution for this problem? Thank you.

Mark Hahn

unread,
Jan 27, 2012, 2:06:03 PM1/27/12
to nod...@googlegroups.com
I don't know about squid, but the proxy I use, nginx, doesn't support websockets so I had to use another port, 81.  It is hard for a proxy to pass websockets.  Can you set up a second server to accept the websockets?

The problem with mixing ssl and non-ssl is that you get a nasty message or ugly red symbol. 

mscdex

unread,
Jan 27, 2012, 9:51:52 PM1/27/12
to nodejs
Out of curiosity, what browser and socket.io transport are being used?

IIRC there's only one "version" of the websocket spec that was non-
HTTP and that was draft 76. However, browsers that support anything
newer than that should work just fine, unless the flash websocket
transport is being used as I'm not sure if that's using a newer
version of the websocket spec.

Faysal Al-Banna

unread,
Jan 27, 2012, 8:11:50 AM1/27/12
to nod...@googlegroups.com
I had the same issue so what i did is that i used msn port :-)
not ideal solution but i had my main process in node.js server accept the request on port 80 and simple page redirect meta tag in the response header response takes it to port 1863 thus successive requests from clients run on port 1863

much regards
--
Faysal Al-Banna
Meteorological Department
Civil Aviation
Rafic Harriri International Airport
Beirut - Lebanon
Tel: +961-1-628000 Ext: 2000
Mobile: +961-3-258043

s0urce

unread,
Jan 28, 2012, 8:39:11 AM1/28/12
to nod...@googlegroups.com

The Problem is,  squid replays With "zero sized package " on connection esteblish and so it fails.

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Srirangan

unread,
Jan 28, 2012, 9:50:12 AM1/28/12
to nod...@googlegroups.com
Does it make sense to avoid using web sockets as the default option in Socket.io?

- Sri

Srirangan  |  About   GitHub  LinkedIn  Twitter  |  Review19  "Next generation, real-time project collaboration"

mscdex

unread,
Jan 28, 2012, 10:27:49 AM1/28/12
to nodejs
On Jan 28, 9:50 am, Srirangan <sriran...@gmail.com> wrote:
> Does it make sense to avoid using web sockets as the default option in
> Socket.io?

You can certainly limit the transports used by socket.io on the client-
side, but I think the number of draft 76 websocket users is greatly
declining now that the websocket spec is now finalized (http://
tools.ietf.org/html/rfc6455). The newest version(s) are already
implemented in most modern browsers.

Dobes

unread,
Jan 29, 2012, 8:51:56 PM1/29/12
to nodejs

The best solution would be to use ssl and port 443 for the whole app.
Websockets are not reliable on port 80 from what I have read, for this
very reason.

Mark Hahn

unread,
Jan 29, 2012, 10:14:55 PM1/29/12
to nod...@googlegroups.com
But if he needs a reverse proxy and the proxy doesn't support websockets then he is screwed no matter what port he uses.

s0urce

unread,
Jan 30, 2012, 3:20:40 AM1/30/12
to nodejs
Thx for all replays. But my problem still exists, the only useable
solution i could see was, running the whole app on port 443. But this
isn't really useable, cause many browsers tells the users about any
cert problems and the certs aren't this cheap as well. And with my
users i can't handle with any security messages, because my users are
affraid of each popup with any alarm word inside. :)
So what would u advise me to do, if u want to reach most possible
users? The really best would be to run on port 80 and fake http header
or something like this, but i am not sure if this is possible. ty

Ryan Schmidt

unread,
Jan 30, 2012, 1:19:31 PM1/30/12
to nod...@googlegroups.com

On Jan 30, 2012, at 02:20, s0urce wrote:

> the only useable
> solution i could see was, running the whole app on port 443. But this
> isn't really useable, cause many browsers tells the users about any
> cert problems and the certs aren't this cheap as well. And with my
> users i can't handle with any security messages, because my users are
> affraid of each popup with any alarm word inside. :)
> So what would u advise me to do, if u want to reach most possible
> users?

Buy an SSL certificate from an established company that was around back when whatever old browser you're concerned about was released, so that there won't be any annoying alert boxes from the browser.


Faysal Al-Banna

unread,
Jan 30, 2012, 6:13:16 PM1/30/12
to nod...@googlegroups.com
No
I've got my main page running port 80 which is ideal for any webpage but inside it i have a meta tag which redirects it to my node.js application running on port 1863 because port 1863 is not firewalled

thus i get my page opened and use socket.io fine .....

much regards
Example :
in my www.myexamplepage.com i have
<html><head><meta http-equiv="refresh" content="0;url=http://www.myexamplepage.com:1863/"></head><body><h1>Opening Page ..... </h1></body></html>

This way my node.js application running with its (socket.io+ Express.js+ whatever modules i have inside it ) on port 1863 and the client has only to open my page then he/she shall be redirected transparently to my nodejs server application page running on port 1863 or whatever port i desire to run it on ....

hope the idea is clear now ...
much regards

On 01/30/2012 10:33 AM, s0urce wrote:
Hi, just had perceived your solution. Sound interessting, but i can't
follow you. Your node listen on port 80, and your socket.io connects
to port 1863?

On 27 Jan., 14:11, Faysal Al-Banna <degre...@gmail.com> wrote:
I had the same issue so what i did is that i used msn port :-)
not ideal solution but i had my main process in node.js server accept
the request on port 80 and simple page redirect meta tag in the response
header response takes it to port 1863 thus successive requests from
clients run on port 1863

much regards

Faysal Al-Banna

unread,
Feb 1, 2012, 3:23:21 AM2/1/12
to nod...@googlegroups.com
no not necessary
you may have two instances of node running one running on port 80 doing just the redirect and the other one running your nodejs application
you can even have same instance of node.js with two servers inside it ...

much regards

On 01/31/2012 01:35 PM, s0urce wrote:

But this is only useful if you run no apache as httpd next to node, isnt it.

Reply all
Reply to author
Forward
0 new messages