You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Helmut K. C. Tessarek" <te...@evermeet.cx> on 2023/07/04 00:27:22 UTC

[users@httpd] reverse proxying websocket connections

The documentation states:

Proxying both HTTP and websockets at the same time, where the websockets URL's 
are not websocket-only or not known in advance can be done by using the 
RewriteRule directive to configure the websockets proxying:

ProxyPass / http://example.com:9080/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://example.com:9080/$1" [P,L]

However, I was wondering, whether the following is an equivalent directive 
(just in a single line ;-)):

ProxyPass / http://example.com:9080/ upgrade=websocket

afaik the upgrade only takes place when it is requested by a header, unless 
upgrade=NONE or upgrade=ANY is set.

Am I correct or are the not the same?

Cheers,
   K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
    Thou shalt not follow the NULL pointer for chaos and madness
    await thee at its end.
*/


Re: [users@httpd] reverse proxying websocket connections

Posted by "Helmut K. C. Tessarek" <te...@evermeet.cx>.
On 2023-07-04 03:58, Yann Ylavic wrote:
> Yes, they should be the same. Upgrade only takes place when requested
> AND accepted/switched by the backend server.

Awesome. Thanks so much for the confirmation.

Have a great day,
   K. C.

-- 
regards Helmut K. C. Tessarek              KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
    Thou shalt not follow the NULL pointer for chaos and madness
    await thee at its end.
*/


Re: [users@httpd] reverse proxying websocket connections

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Jul 4, 2023 at 2:28 AM Helmut K. C. Tessarek
<te...@evermeet.cx> wrote:
>
> The documentation states:
>
> Proxying both HTTP and websockets at the same time, where the websockets URL's
> are not websocket-only or not known in advance can be done by using the
> RewriteRule directive to configure the websockets proxying:
>
> ProxyPass / http://example.com:9080/
> RewriteEngine on
> RewriteCond %{HTTP:Upgrade} websocket [NC]
> RewriteCond %{HTTP:Connection} upgrade [NC]
> RewriteRule ^/?(.*) "ws://example.com:9080/$1" [P,L]
>
> However, I was wondering, whether the following is an equivalent directive
> (just in a single line ;-)):
>
> ProxyPass / http://example.com:9080/ upgrade=websocket
>
> afaik the upgrade only takes place when it is requested by a header, unless
> upgrade=NONE or upgrade=ANY is set.
>
> Am I correct or are the not the same?

Yes, they should be the same. Upgrade only takes place when requested
AND accepted/switched by the backend server.


Regards;
Yann.

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