You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Fladischer <mi...@fladi.at> on 2016/05/21 19:43:30 UTC

[users@httpd] mod_proxy_wstunnel with Unix domain sockets

Hi folks,

I have a Python ornado base websocket application that listens on a
Unix domain socket. It was initially written to work with nginx as its
frontend webserver.

Now i'm trying to make it work with Apache but it seems that
mod_proxy_wstunnel is not meant to work with Unix domain sockets.

What I tried so far in my configuration:

ProxyPass "/ws" "unix:/tmp/app.sock|ws://example.com/ws"

When I try to call this websocket endpoint with curl this shows up in
the Apache error log:

AH01144: No protocol handler was valid for the URL /ws. If you are
using a DSO version of mod_proxy, make sure the proxy submodules are
included in the configuration using LoadModule.

There seems to be a problem with URL parsing somewhere in the proxy
system. mod_proxy.so and mod_proxy_wstunnel.so are both loaded.

Does anyone have an idea what needs to be changed to make this work?

Cheers,
-- 
Michael Fladischer
Fladi.at


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Michael Fladischer <mi...@fladi.at>.
On 2016-06-13 18:49, Jim Jagielski wrote:
> Thx for the report. Will investigate!

I used mod_dumpio to look what's going on when I try to open a websocket
connection inside Apache. It seems that mod_proxy_wstunnel actually
discards the "unix:/path|" in my ProxyPass configuration:

ProxyPass "/ws/" "unix:/tmp/some.sock|ws://xxx"

Using dumpio, I can see that there is a try to resolve "xxx" into an IP
address which fails. If I replace "ws://xxx" with an URL to a working
websocket server listening on TCP/IP, mod_proxy_wstunnel works, but does
not use the unix socket where my actual websocket application is listening.

HTH,
-- 
Michael Fladischer
Fladi.at


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Jim Jagielski <ji...@jaguNET.com>.
Thx for the report. Will investigate!

> On Jun 4, 2016, at 2:39 AM, Michael Fladischer <mi...@fladi.at> wrote:
> 
> On 2016-05-22 20:51, Jim Jagielski wrote:
>> What version of httpd are you using?
> 
> Debian testing now updated to 2.4.20 but the problem still persists. No
> connection is established if the mod_proxy_wstunnel endpoint is a unix
> domain socket.
> 
> Cheers,
> -- 
> Michael Fladischer
> Fladi.at
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Michael Fladischer <mi...@fladi.at>.
On 2016-05-22 20:51, Jim Jagielski wrote:
> What version of httpd are you using?

Debian testing now updated to 2.4.20 but the problem still persists. No
connection is established if the mod_proxy_wstunnel endpoint is a unix
domain socket.

Cheers,
-- 
Michael Fladischer
Fladi.at


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Michael Fladischer <mi...@fladi.at>.
On 2016-05-22 20:51, Jim Jagielski wrote:
> What version of httpd are you using?

I'm using 2.4.18 from Debian/testing on amd64.

Cheers,
-- 
Michael Fladischer
Fladi.at


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Jim Jagielski <ji...@jaguNET.com>.
Hmmm... let me look. 

What version of httpd are you using?

> On May 21, 2016, at 3:43 PM, Michael Fladischer <mi...@fladi.at> wrote:
> 
> Hi folks,
> 
> I have a Python ornado base websocket application that listens on a
> Unix domain socket. It was initially written to work with nginx as its
> frontend webserver.
> 
> Now i'm trying to make it work with Apache but it seems that
> mod_proxy_wstunnel is not meant to work with Unix domain sockets.
> 
> What I tried so far in my configuration:
> 
> ProxyPass "/ws" "unix:/tmp/app.sock|ws://example.com/ws"
> 
> When I try to call this websocket endpoint with curl this shows up in
> the Apache error log:
> 
> AH01144: No protocol handler was valid for the URL /ws. If you are
> using a DSO version of mod_proxy, make sure the proxy submodules are
> included in the configuration using LoadModule.
> 
> There seems to be a problem with URL parsing somewhere in the proxy
> system. mod_proxy.so and mod_proxy_wstunnel.so are both loaded.
> 
> Does anyone have an idea what needs to be changed to make this work?
> 
> Cheers,
> -- 
> Michael Fladischer
> Fladi.at
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Michael Fladischer <mi...@fladi.at>.
On 2016-05-22 15:49, Reko Turja wrote:
> The app in question was IP-socket based, but I think the basic idea is
> the same, both reverse and forward proxying has to be configured as well
> as secured channel if needed.

I added ProxyPassReverse but that did not have any effect. As I would
need to run quite a few instances of this ws-application I would like to
avoid cluttering my TCP ports.

Cheers,
-- 
Michael Fladischer
Fladi.at


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Reko Turja <re...@liukuma.net>.
-----Original Message----- 
From: Michael Fladischer
Sent: Saturday, May 21, 2016 10:43 PM

> What I tried so far in my configuration:

> ProxyPass "/ws" "unix:/tmp/app.sock|ws://example.com/ws"

> Does anyone have an idea what needs to be changed to make this work?

The "incantation I needed for getting one IP socket application with 
some http payload to run proxied was:

ProxyPass "/app" "http://localhost:port
ProxyPassReverse "/app" "http://localhost:port"
ProxyPass "/appws" "ws://localhost:port"
ProxyPass "/appws" "wss://localhost:port"
ProxyPassReverse "/appws" "ws://localhost:port"
ProxyPassReverse "/appws" "wss://localhost:port"

+ <Directory> definitions for both /app and /appws

The app in question was IP-socket based, but I think the basic idea is 
the same, both reverse and forward proxying has to be configured as 
well as secured channel if needed.

-Reko 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Michael Fladischer <mi...@fladi.at>.
On 2016-05-22 15:19, Eric Covener wrote:
> I got marginally farther (wstunnell connected to example.com so
> something is still amiss).

My tornado application listening on the UDS does not see any incoming
connections. So it seems that it hangs somewhere in Apache.

>  Are you sure your curl test had an Upgrade: WebSocket header?  That
> is one thing that makes wstunnell decline to handle the request.

You are right, curl missed the required headers. I went on to test it
with `wscat`[0] and Echo Test[1]. Both work when I use nginx to proxy
the connection to my UDS. But no response when using it with Apache.

[0] http://websockets.github.io/ws/
[1] http://www.websocket.org/echo.html

Cheers,
-- 
Michael Fladischer
Fladi.at


Re: [users@httpd] mod_proxy_wstunnel with Unix domain sockets

Posted by Eric Covener <co...@gmail.com>.
On Sat, May 21, 2016 at 3:43 PM, Michael Fladischer <mi...@fladi.at> wrote:
> AH01144: No protocol handler was valid for the URL /ws. If you are
> using a DSO version of mod_proxy, make sure the proxy submodules are
> included in the configuration using LoadModule.
>
> There seems to be a problem with URL parsing somewhere in the proxy
> system. mod_proxy.so and mod_proxy_wstunnel.so are both loaded.
>
> Does anyone have an idea what needs to be changed to make this work?


I got marginally farther (wstunnell connected to example.com so
something is still amiss).

 Are you sure your curl test had an Upgrade: WebSocket header?  That
is one thing that makes wstunnell decline to handle the request.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org