Page MenuHomePhabricator
Paste P2025

Aphlict behind Apache

Authored by lewellyn on Dec 12 2016, 3:40 AM.
As of Apache 2.4.5, `mod_proxy_wstunnel` is available, which (of course) requires `mod_proxy`:
This module is part of recent Debian/Ubuntu packages, so you should be able to just `a2enmod proxy_wstunnel && systemctl restart apache2` before continuing. For other platforms, use whatever magic you normally would use to check if a module is available and enabled.
Your Apache configuration should already have this:
RewriteEngine on
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
Change it to this (and restart Apache):
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/ws/
RewriteCond %{QUERY_STRING} transport=websocket
RewriteRule /(.*) ws://localhost:22280/$1 [B,P,L]
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
As the doc at says, configure your Phabricator accoridngly. Everything should now "just work". Close off port 22280 on your firewall, grab a beverage, and relax.

Event Timeline

lewellyn created this paste.Dec 12 2016, 3:40 AM
lewellyn mentioned this in Z1336: General Chat.
lewellyn edited the content of this paste. (Show Details)Dec 12 2016, 4:16 AM

The above did not work for me. The following did:

# Load PHP.
LoadModule php7_module lib/httpd/
<FilesMatch \.php$>
    SetHandler application/x-httpd-php

LoadModule rewrite_module lib/httpd/

# Needed in order to proxy websockets connection for Phabricator's aphlict.
LoadModule proxy_module lib/httpd/
LoadModule proxy_wstunnel_module lib/httpd/

ProxyRequests Off

<VirtualHost *>

  DocumentRoot /opt/phacility/phabricator/webroot

  RewriteEngine on
  # Rewrite everything except for the websocket location.
  RewriteCond %{REQUEST_URI} !^/ws/
  RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]
  <Location "/ws/">
    ProxyPass        ws:// nocanon
  <Directory "/opt/phacility/phabricator/webroot">
    Require all granted