I’m an nginx newbie, and need use use it as a front end for a website
that also handles websocket connections. I have the configuration set
up so that requests to a specific URI match a location section, which
then proxies the request to the websocket back end server, and it all
works. (Very cool.)
However, I was wondering if, rather than detecting requests to a
specific location, I could proxy all “ws://” or "wss:// requests,
independent of the URI being requested.
Is there a way to proxy all requests with a given protocol?
Thanks,
Dan
–
Daniel T. Griscom [email protected]
Suitable Systems http://www.suitable.com/
1 Centre Street, Suite 204 (781) 665-0053
Wakefield, MA 01880-2400
… bump?
(thanks,
Dan)
At 9:32 AM -0400 5/8/13, Daniel Griscom wrote:
Is there a way to proxy all requests with a given protocol?
nginx mailing list
[email protected]
nginx Info Page
–
Daniel T. Griscom [email protected]
Suitable Systems http://www.suitable.com/
1 Centre Street, Suite 204 (781) 665-0053
Wakefield, MA 01880-2400
The scheme is available as… $scheme
On Thu, 2013-05-09 at 14:45 -0400, Daniel Griscom wrote:
location section, which then proxies the request to the websocket
Dan
nginx Info Page
–
Steve H. BSc(Hons) MNZCS [email protected]
MSN: [email protected]
Skype: sholdowa
Hello!
On Fri, May 10, 2013 at 09:14:04AM +1200, Steve H. wrote:
The scheme is available as… $scheme
Yes, but WebSocket protocol uses http for handshake. So the
scheme will be either “http” or “https”. WebSocket requests can
be identified based on Upgrade header, i.e. $http_upgrade
variable.
website that also handles websocket connections. I have the
nginx mailing list
nginx mailing list
[email protected]
nginx Info Page
–
Maxim D.
http://nginx.org/en/donation.html
Hello!
On Fri, May 10, 2013 at 02:35:35PM -0400, Daniel Griscom wrote:
… any other choices? Thoughts?
I would recommend using URI-based distinction instead (and
location{} blocks as a result). This would be most natural
solution from nginx point of view.
–
nginx Info Page
–
Daniel T. Griscom [email protected]
Suitable Systems http://www.suitable.com/
1 Centre Street, Suite 204 (781) 665-0053
Wakefield, MA 01880-2400
nginx mailing list
[email protected]
nginx Info Page
–
Maxim D.
http://nginx.org/en/donation.html
That’s great information, but now I need to figure out how to
selectively proxy to my websocket backend when $http_upgrade is
“websocket”. I see the following choices:
-
Have nginx listen at port 80, and proxy all traffic to port XXXX
if $http_upgrade is “websocket”, or port YYYY if not. Then set up
nginx to handle http traffic at port YYYY, and have my websocket
backend handle websocket traffic at port XXXX.
-
Investigate the much-maligned “if” statement.
… any other choices? Thoughts?
Thanks,
Dan
At 1:26 PM +0400 5/10/13, Maxim D. wrote:
website that also handles websocket connections. I have the
nginx mailing list
nginx mailing list
[email protected]
nginx Info Page
–
Daniel T. Griscom [email protected]
Suitable Systems http://www.suitable.com/
1 Centre Street, Suite 204 (781) 665-0053
Wakefield, MA 01880-2400
Thanks. I’ve been coming to that conclusion myself.
Take care,
Dan
At 7:00 PM +0400 5/11/13, Maxim D. wrote:
nginx to handle http traffic at port YYYY, and have my websocket
–
nginx Info Page
–
Maxim D.
nginx: donation
nginx mailing list
[email protected]
nginx Info Page
–
Daniel T. Griscom [email protected]
Suitable Systems http://www.suitable.com/
1 Centre Street, Suite 204 (781) 665-0053
Wakefield, MA 01880-2400