To check whether HAproxy is working properly, we can do the following.
First, prepare test.php file with the following content:
< ?php header('Content-Type: text/plain'); echo "Server IP: ".$_SERVER['SERVER_ADDR']; echo "\nX-Forwarded-for: ".$_SERVER['HTTP_X_FORWARDED_FOR']; ?>