Set header for CURL query for the Notification server status to HTTP:Upgrade = websocket
Closed, InvalidPublic

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 updated 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.

@jmeador I tried your suggested configuration. The system works, but the server/config/cluster/notifications/ gives the following error instead:

Connection Error[HTTP/500] Internal Server Error <!DOCTYPE html><html><head><meta charset="UTF-8" /><title>Login to Phabricator</title><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /><link rel="mask-icon" color="#3D4B67" href="https://server/res/phabricator/e132a80f/rsrc/favicons/mask-icon.svg" /><link rel="apple-touch-icon" href="https://server/res/phabricator/2d061a11/rsrc/favicons/apple-touch-icon-76x76.png" /><link rel="apple-touch-icon" sizes="120x120" href="https://server...
epriestley closed this task as Invalid.Apr 7 2017, 1:18 PM
epriestley added a subscriber: epriestley.

This isn't a bug; the cURL request is not a websocket request.