If you are having trouble with a web application sitting behind a reverse proxy, debugging can be facilitated by having your (backend) web-server displaying the headers that it receives.
<?php
echo “<h1>Headers received from the reverse proxy</h1>";
$headers = getallheaders();
foreach($headers as $key=>$val){
echo $key . ': ' . $val . '<br>';
}
?>
Command | parameter 1 | parameter 2 | output |
---|---|---|---|
proxy_set_header | X-Real-IP | $remote_addr; | IP Address of client |
proxy_set_header | X-Forwarded-For | $proxy_add_x_forwarded_for; | IP Address of client |
proxy_set_header | X-Forwarded-Host | $server_name; | called vhost |
proxy_set_header | X-Forwarded-Proto | $scheme; | https or http |
proxy_set_header | |||
If you want to test how your page and headers look like from outside, call it from a site like https://testlocal.ly .