Dear Aleks,

As you advised, in the file ../Product1/interface/globals.php, we
(a) Reviewed Line 137/138.  This takes the value from Line 67/68.
(b) Conducted two tests.
Here are the results. We would appreciate any vector to solve this external access via HAProxy issue.

TEST CASE 1:
With the original product1 code, we are able to access it within company’s internal network via local DNS. But we cannot access the product externally through HAProxy.

In logs, the prefix /product1 gets deleted after a few lines (see line#4 in logs below) in internal hyperlinks of the product.

<?php print_r($rootdir);?>
Output on page = /interface

TEST CASE 2:
When we manually input the path as below, we are able to access the product externally through HAProxy. But we cannot access it within company’s internal network via local DNS.

In logs below, the prefix /Product1 appears in internal hyperlinks of the product.

   Line 67:    $webserver_root = "/usr/local/Product1";
   Line 68:    $web_root =  "/Product1";

<?php print_r($rootdir);?>
Output on page = /product1/interface

+++++++
HAProxy configuration
+++++++
    http-request set-header Host <SERVER_IP:APPLICATION_PORT>
    reqirep ^([^\ ]*)\ /Product1/?([^\ ]*)\ (.*)$       \1\ /\2\ \3
    acl hdr_location res.hdr(Location) -m found
rspirep ^Location:\ (https?://)(Product1).vm0.internal.domain(:[0-9]+)?(/.*)?(.*) Location:\/\2\3\4 if hdr_location #rspirep ^Location:\ (https?://Product1.vm0.internal.domain(:[0-9]+)?)?(/.*) Location:\ /Product1\3 if hdr_location
    #cookie
acl hdr_set_cookie_dom res.hdr(Set-cookie) -m sub Domain= Product1.vm0.internal.domain rspirep ^(Set-Cookie:.*)\ Domain=Product1.vm0.internal.domain(.*) \1\ Domain=<FQDN>\2 if hdr_set_cookie_dom
    acl hdr_set_cookie_path res.hdr(Set-cookie) -m sub Path=
rspirep ^(Set-Cookie:.*)\ Path=(.*) \1\ Path=/Product1\2 if hdr_set_cookie_path
    server Product1.vm0 Product1.vm0.internal.domain:80 cookie p1-p check

+++++++++++
Info.Log
++++++++
CASE 1: With the original product code, 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 /Product1/interface/login/login_frame.php?site=default HTTP/1.1" 200 1159 "" "" 62551 160 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/login_frame.php?site=default HTTP/1.1" 200 1159 "" "" 62551 160 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/themes/login.css HTTP/1.1" 304 129 "" "" 62551 202 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/themes/login.css HTTP/1.1" 304 129 "" "" 62551 202 "webapps-frontend~" "subdomain_p1-backend" "Product1.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" "<NOSRV>" 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" "<NOSRV>" 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" "<NOSRV>" 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" "<NOSRV>" 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 /Product1 appears in internal hyperlinks of the product1.
Nov 4 13:07:30 localhost haproxy[5246]: 192.168.100.153 - - [04/Nov/2015:19:07:30 +0000] "GET /Product1/ HTTP/1.1" 302 235 "" "" 63715 211 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/ HTTP/1.1" 302 235 "" "" 63715 211 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/login_frame.php?site=default HTTP/1.1" 200 1214 "" "" 63715 248 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/login_frame.php?site=default HTTP/1.1" 200 1214 "" "" 63715 248 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/filler.php HTTP/1.1" 200 750 "" "" 63715 264 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/filler.php HTTP/1.1" 200 750 "" "" 63715 264 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/login_title.php HTTP/1.1" 200 659 "" "" 63718 286 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/login_title.php HTTP/1.1" 200 659 "" "" 63718 286 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/login.php HTTP/1.1" 200 3907 "" "" 63719 287 "webapps-frontend~" "subdomain_p1-backend" "Product1.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 /Product1/interface/login/login.php HTTP/1.1" 200 3907 "" "" 63719 287 "webapps-frontend~" "subdomain_p1-backend" "Product1.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" "<NOSRV>" 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" "<NOSRV>" 27 -1 -1 -1 27 SC-- 2 2 0 0 0 0 0 "" ""
===========

Thank you.

Sincerely,
Susheel Jalali
www.Coscend.com

On 11/03/15 12:00, Aleksandar Lazic wrote:
> Dear Susheel Jalali
>
> Am 02-11-2015 20:24, schrieb Susheel Jalali:
>> Dear Aleks,
>
> [snipp]
>
>> We modified this solution (of Apache) to work with HAProxy, but did
>> not succeed.  Is there any insight anyone could provide?
>
> What have you changed?
> Please post your current config.
>
>> +++++++++++
>> Internal Hyperlinks in our PHP page:
>> +++++++++++
>> <frameset rows="<?php echo
>> "$GLOBALS[logoBarHeight],$GLOBALS[titleBarHeight]" ?>,*" cols="*"
>> frameborder="NO" border="0" framespacing="0">
>>    <frame class="logobar" src="<?php echo
>> $rootdir;?>/login/filler.php" name="Filler Top" scrolling="no"
>> noresize frameborder="NO">
>>    <frame class="titlebar" src="<?php echo
>> $rootdir;?>/login/login_title.php" name="Title" scrolling="no"
>> noresize frameborder="NO">
>>    <frame src="<?php echo $rootdir;?>/login/login.php" name="Login"
>> scrolling="auto" frameborder="NO">
>> </frameset>
>
> please add <?php print_r($rootdir);?> to the PHP page and post the output.
>
> You have not answered if my Assumption was right!
>
> I still assume that you try to run
>
> http://open-emr.org
>
> therefore please take a look into this code.
>
> https://github.com/openemr/openemr/blob/8b9d250de3c76aeb4f706342c2f3c3f1e1b9c6db/interface/globals.php#L137
>
> https://github.com/openemr/openemr/blob/8b9d250de3c76aeb4f706342c2f3c3f1e1b9c6db/interface/globals.php#L38
>
> Best regards
> Aleks
>
>> On 10/31/15 14:36, Aleksandar Lazic wrote:
>>> Dear Susheel Jalali.
>>>
>>> Am 31-10-2015 08:43, schrieb Susheel Jalali:
>>>> Dear HAProxy Developers:
>>>
>>> [snipp]
>>>
>>>> This is same as what Apache server’s mod_proxy_html serves to:
>>>> rewrite <a href="http://appserver.example.com/foo/bar.html";>foobar</a> >>>> to <a href="http://www.example.com/appserver/foo/bar.html";>foobar</a>.
>>>> Is there an output filter equivalent of Apache server’s mod_proxy_html
>>>> in HAProxy to rewrite internal links in:
>>>> (i) a PHP page?
>>>> (ii) an HTML page?
>>>
>>> Assumption:
>>>
>>> you use http://open-emr.org
>>>
>>> conclusion:
>>>
>>> http://www.open-emr.org/wiki/index.php/Apache2_Notes
>>>
>>> follow up
>>>
>>> http://blog.haproxy.com/2014/04/28/howto-write-apache-proxypass-rules-in-haproxy/ Have I assumed right and was you able to step forward?
>>>
>>> BR Aleks


Reply via email to