Page MenuHomeDevCentral

Preamble script for Phabricator
Closed, ResolvedPublic

Description

The following code works fine on this installation:

/opt/phabricator/support/preamble.php
<?php

/**
 * Preamble script to play nice with a nginx reverse proxy.
 *
 * Shipped with Docker nasqueron/phabricator image.
 */

// We trust the answer of nginx.
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];

// Phabricator uses the HTTPS variable to determine the protocol.
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
        $_SERVER['HTTPS'] = true;
}

It allows to a better activity log accuracy (remote IP is printed instead of the container IP, so sessions are more distinguishable) and fix HTTP/HTTPS issues.

We should commit this file to rDPHAB, to allow other HTTPS installation to work fine.