Skip to content

Installing behind a reverse proxy

Steven Dodd edited this page Jan 31, 2024 · 2 revisions

Apache https Reverse Proxy

The following example shows you how to configure an apache reverse proxy. This is useful in the case that you're hosting with a single external domain name and you wish to provide external access to Cloudlog along with other services.

The example configuration below exposes the external URL https://<external domain>/cloudlog which then proxies to http://<cloudlog server ip address>

Note: In this case the external server is https while the internal cloudlog server is http; It is also rewriting the /cloudlog folder as most Cloudlog instances will be installed in the default /var/www/html folder. Modify as required.

application/config/config.php

// Modify in the provided section for base_url config.php
if ($_SERVER['REMOTE_ADDR'] == '<proxy ip address>') {
  $config['base_url'] = 'https://<external domain>/cloudlog/';
} else {
  $config['base_url'] = 'http://<cloudlog server ip address>';
}

// Modify in the provided section at the end of config.php
$config['proxy_ips'] = '<proxy ip address>';

Apache2 proxy virtualhost

    ProxyPreserveHost Off
    ProxySourceAddress <proxy ip address>
    RequestHeader set X-Forwarded-Proto "https" early
    RequestHeader set  X-Forwarded-Host "<external domain>" early
    ProxyPass /cloudlog http://<cloudlog server ip address>
    ProxyPassReverse /cloudlog http://<cloudlog server ip address>
    ProxyPassReverseCookieDomain  "<cloudlog server ip address>"  "<external domain>"
    ProxyPassReverseCookiePath  "/"  "/cloudlog/"
Clone this wiki locally