httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damien Clark <>
Subject Re: [users@httpd] RE: Web sockets & proxypass - No protocol handler was valid for the URL
Date Thu, 07 Sep 2017 23:09:44 GMT

> On 8 Sep 2017, at 2:04 am, Eric Covener <> wrote:
> On Thu, Sep 7, 2017 at 10:19 AM, Damien Clark <> wrote:
>>> On 7 Sep 2017, at 11:53 pm, Eric Covener <> wrote:
>>>> I am wondering whether the use of a rewriterule with the “P” flag is
the reason the upgrade header hasn’t been included.  I wonder this because it is pretty
widely reported to work fine when using ProxyPass to ws uri.
> Since you have 2.4.27, can you try (untested -- please log
> %{no-proxy}e to make sure nothing subtle is wrong)

The logs don’t seem to be showing that the env variable is properly being set.  I checked
to make sure ‘setenvif’ module is loaded.

Here is the LogFormat I set:

LogFormat "%t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{no-proxy}e" debug
CustomLog "logs/debug.log" debug

Excerpt from the log comparing two different request types - one with the upgrade (transport=websocket),
the other without:

[08/Sep/2017:08:56:36 +1000] "GET / HTTP/1.1"
200 101 "" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:55.0) Gecko/20100101
Firefox/55.0" -
[08/Sep/2017:08:56:36 +1000] "GET /
HTTP/1.1" 400 34 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:55.0) Gecko/20100101
Firefox/55.0” -

The no-proxy is unset for both (denoted by the ‘-' I assume).  I’ve double checked and
the transport=websocket request from the browser definitely has the Upgrade: websocket header,
while the former definitely does not.

Here is the apache config I am using so you can see exactly what I have done:

   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/

   <Directory /var/www/>
      Options -Indexes +FollowSymLinks
      AllowOverride None
      Require all granted
   <Proxy *>
      Require all granted

    ProxyRequests Off
    ProxyPreserveHost On
    ProxyVia Full

  # Don't allow ProxyPass to find these
  SetEnvIf Upgrade (?i)websocket no-proxy=1

  RewriteEngine on
  RewriteCond %{HTTP:Upgrade} "(?i)websocket"
  RewriteRule ^/(.*)$ ws://localhost:3000/$1 [P]

  ProxyPass        / http://localhost:3000/
   LogFormat "%t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{no-proxy}e" debug
   CustomLog "logs/debug.log" debug
   LogLevel warn

Have I missed something?

Thanks again for your help Eric.


> # Don't allow ProxyPass to find these
> SetEnvIf Upgrade (?i)websocket no-proxy=1
> RewriteRule ... [P,E=no-proxy:1] is too late unfortunately.
> no-proxy should not block RewriteBased [P] flag, only the ProxyPass.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message