Set header for CURL query for the Notification server status to HTTP:Upgrade = websocket
Open, Needs TriagePublic

Description

Phabricator Versions:
phabricator f844280d360c8acd4c2864733efd8e58a5507d80 (Tue, Nov 29)
arcanist fad85844314b151994769a461825c90f7400c145 (Oct 22 2016)
phutil 3070098f1b6db23817a0dfced35d11d9c3615e04 (Wed, Nov 30)

When the Webserver (Apache Proxy) is set to handle the WebSocket queries through rewrite rule:

RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*)            ws://localhost:22280/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]

The notification system works, but the notification status server/config/cluster/notifications/ gives the following error:

https	server	443	Connection Error				Got HTTP 200, but expected HTTP 501 (WebSocket Upgrade)!

Is it possible to set the HTTP:Upgrade header for the CURL check query?

pouyana created this task.Dec 13 2016, 11:36 AM
pouyana edited the task description. (Show Details)Dec 13 2016, 12:54 PM
eadler added a subscriber: eadler.Dec 15 2016, 7:51 PM

@pouyana Here's a workaround for you. In your notification.servers Phabricator configuration, add path: "/ws/" to the client server. Then, modify your apache configuration like so:

RewriteCond %{REQUEST_URI}  ^/ws/(.*)
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*)            ws://localhost:22280/$1 [P,L]
RewriteCond %{REQUEST_URI}  ^/ws/(.*)
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*)            http://localhost:22280/$1 [P,L]

RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]

This should result in HTTP requests for /ws/ proxied to aphlict, which returns the appropriate 501.