Skip to content

An simple way to create reverse proxy using heroku & caddy

Notifications You must be signed in to change notification settings

izulwahidin/Heroku-Reverse-Proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heroku Reverse Proxy with Caddy

Deploy

for wordpress reverse proxy, open your wp-config.php. after PHP tag opening at the beginning of the file, add these lines of code:

<?php
// Proxy Configuration
define('PROXY_DOMAIN', 'wahidin-proxy.herokuapp.com'); // Update with your proxy domain (no http/s or trailing slash)

// Server and Cookie Settings
define('COOKIE_DOMAIN', PROXY_DOMAIN);
define('SITECOOKIEPATH', '.');

// Handle Forwarded IP
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $_SERVER['REMOTE_ADDR'] = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0];
}

// Override Server Variables
$_SERVER['HTTP_HOST'] = PROXY_DOMAIN;
$_SERVER['REMOTE_ADDR'] = 'https://' . PROXY_DOMAIN;
$_SERVER['SERVER_ADDR'] = PROXY_DOMAIN;

// Set HTTPS if Forwarded Proto is HTTPS
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
    $_SERVER['HTTPS'] = 'on';
}

// WordPress URL Configuration
define('WP_HOME', 'https://' . PROXY_DOMAIN);
define('WP_SITEURL', 'https://' . PROXY_DOMAIN);

About

An simple way to create reverse proxy using heroku & caddy

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published