How to Access OpenEMR via reverse proxy load balancer HAProxy

susheeljalali wrote on Sunday, November 08, 2015:

Dear OpenEMR Developer and User Community,

We would appreciate your guidance on how to access OpenEMR via reverse proxy load balancer HAProxy.
We have set up OpenEMR with Apache HTTP server (2.4.12) and MariaDB (10.0.16).
· We are able to access and log into OpenEMR within company’s internal network athttp://openemr.local.domain.
· We have configured reverse proxy load balancer (HAProxy) to access OpenEMR athttp:///openemr/. Unfortunately, we are unable to access it via HAProxy in various test cases described below.
Our investigation suggests internal hyperlinks of OpenEMR are not accessible via HAProxy. What coding or other steps do we need to do solve this issue?
+++++++++++++++++++++++++++++++++
TEST CASE 1:

With the original source code (no changes) of OpenEMR, we are able to access and login into the product within company’s internal network via local DNS. But we cannot access the product externally through reverse proxy HAProxy.
In HAProxy access logs, the prefix /openemr gets deleted after a few lines (see line#4 in logs below) in internal hyperlinks of the product.
To test, we added this line to …/openemr/interface/login/ login_frame.php

<?php print_r($rootdir);?>

Output on page = /interface

TEST CASE 2:
+++++++++++
When we manually input the path as below in …/interface/globals.php, we are able to access the product from WAN through reverse proxy HAProxy. But we cannot access it within company’s internal network via local DNS.
In logs below, the prefix /openemr appears in internal hyperlinks of the product.
Line 67: $webserver_root = “/usr/local/openemr”;
Line 68: $web_root = “/openemr”;
To test, we added this line to …/openemr/interface/login/ login_frame.php

<?php print_r($rootdir);?>
Output on page = /openemr/interface
+++++++++++
Info.Log of reverse proxy load balancer HAProxy
++++++++
CASE 1: With the original OpenEMR source code installed, we are able to access it within company’s internal network via local DNS. But we cannot access the product externally through HAProxy.
Oct 30 18:25:42 localhost haproxy[18120]: 192.168.100.153 - - [30/Oct/2015:23:25:42 +0000] “GET /openemr/interface/login/login_frame.php?site=default HTTP/1.1” 200 1159 “” “” 62551 160 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 28 0 1 13 42 ---- 1 1 0 1 0 0 0 “” “”
Oct 30 18:25:42 localhost haproxy[18120]: 192.168.100.153 - - [30/Oct/2015:23:25:42 +0000] “GET /openemr/interface/login/login_frame.php?site=default HTTP/1.1” 200 1159 “” “” 62551 160 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 28 0 1 13 42 ---- 1 1 0 1 0 0 0 “” “”
Oct 30 18:25:42 localhost haproxy[18120]: 192.168.100.153 - - [30/Oct/2015:23:25:42 +0000] “GET /openemr/interface/themes/login.css HTTP/1.1” 304 129 “” “” 62551 202 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 10 0 1 0 11 ---- 1 1 0 1 0 0 0 “” “”
#4: Oct 30 18:25:42 localhost haproxy[18120]: 192.168.100.153 - - [30/Oct/2015:23:25:42 +0000] “GET /openemr/interface/themes/login.css HTTP/1.1” 304 129 “” “” 62551 202 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 10 0 1 0 11 ---- 1 1 0 1 0 0 0 “” “”
#5: Oct 30 18:25:42 localhost haproxy[18120]: 192.168.100.153 - - [30/Oct/2015:23:25:42 +0000] “GET /interface/login/filler.php HTTP/1.1” 503 213 “” “” 62551 214 “webapps-frontend~” “webapps-backend” “” 2 -1 -1 -1 2 SC-- 2 2 0 0 0 0 0 “” “”
Oct 30 18:25:42 localhost haproxy[18120]: 192.168.100.153 - - [30/Oct/2015:23:25:42 +0000] “GET /interface/login/filler.php HTTP/1.1” 503 213 “” “” 62551 214 “webapps-frontend~” “webapps-backend” “” 2 -1 -1 -1 2 SC-- 2 2 0 0 0 0 0 “” “”
Oct 30 18:25:42 localhost haproxy[18120]: 192.168.100.153 - - [30/Oct/2015:23:25:42 +0000] “GET /interface/login/login_title.php HTTP/1.1” 503 213 “” “” 62557 222 “webapps-frontend~” “webapps-backend” “” 4 -1 -1 -1 4 SC-- 3 3 0 0 0 0 0 “” “”
Oct 30 18:25:42 localhost haproxy[18120]: 192.168.100.153 - - [30/Oct/2015:23:25:42 +0000] “GET /interface/login/login_title.php HTTP/1.1” 503 213 “” “” 62557 222 “webapps-frontend~” “webapps-backend” “” 4 -1 -1 -1 4 SC-- 3 3 0 0 0 0 0 “” “”

CASE 2: When we manually input the path, we are able to access the product externally through HAProxy. But we cannot access it within company’s internal network via local DNS.
The prefix /openemr appears in internal hyperlinks of the openemr.
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/ HTTP/1.1” 302 235 “” “” 63715 211 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 35 0 0 1 36 ---- 1 1 0 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/ HTTP/1.1” 302 235 “” “” 63715 211 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 35 0 0 1 36 ---- 1 1 0 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/interface/login/login_frame.php?site=default HTTP/1.1” 200 1214 “” “” 63715 248 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 2 0 0 13 15 ---- 1 1 0 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/interface/login/login_frame.php?site=default HTTP/1.1” 200 1214 “” “” 63715 248 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 2 0 0 13 15 ---- 1 1 0 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/interface/login/filler.php HTTP/1.1” 200 750 “” “” 63715 264 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 13 0 0 11 24 ---- 5 5 0 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/interface/login/filler.php HTTP/1.1” 200 750 “” “” 63715 264 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 13 0 0 11 24 ---- 5 5 0 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/interface/login/login_title.php HTTP/1.1” 200 659 “” “” 63718 286 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 2 0 1 10 13 ---- 3 3 1 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/interface/login/login_title.php HTTP/1.1” 200 659 “” “” 63718 286 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 2 0 1 10 13 ---- 3 3 1 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/interface/login/login.php HTTP/1.1” 200 3907 “” “” 63719 287 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 2 0 0 34 36 ---- 3 3 0 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /openemr/interface/login/login.php HTTP/1.1” 200 3907 “” “” 63719 287 “webapps-frontend~” “subdomain_p1-backend” “openemr.vm0” 2 0 0 34 36 ---- 3 3 0 1 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /favicon.ico HTTP/1.1” 503 213 “” “” 63719 324 “webapps-frontend~” “webapps-backend” “” 27 -1 -1 -1 27 SC-- 2 2 0 0 0 0 0 “” “”
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] “GET /favicon.ico HTTP/1.1” 503 213 “” “” 63719 324 “webapps-frontend~” “webapps-backend” “” 27 -1 -1 -1 27 SC-- 2 2 0 0 0 0 0 “” “”
Thank you.
Sincerely,
Susheel Jalali
www.Coscend.com

CONFIDENTIALITY NOTICE: See ‘Confidentiality Notice Regarding E-mail Messages from Coscend Communications Solutions’ posted at: http://www.Coscend.com/Terms_and_Conditions.html