Re: RE: Web sockets & proxypass - No protocol handler was valid for the URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 8 Sep 2017, at 2:04 am, Eric Covener <covener@xxxxxxxxx> wrote:

On Thu, Sep 7, 2017 at 10:19 AM, Damien Clark <damo.clarky@xxxxxxxxx> wrote:

On 7 Sep 2017, at 11:53 pm, Eric Covener <covener@xxxxxxxxx> 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 /socket.io/?EIO=3&transport=polling&t=LvUZo-4 HTTP/1.1" 200 101 "http://buzzer.click/" "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 /socket.io/?EIO=3&transport=websocket&sid=2CxfW3Fj5pDd7mpWAAAf 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:

<VirtualHost buzzer.click:80>
   ServerAdmin webmaster@localhost
   ServerName buzzer.click
 
   DocumentRoot /var/www/buzzer.click/www

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

    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
</VirtualHost>

Have I missed something?

Thanks again for your help Eric.

D.


# 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: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux