Page 1 of 1

Proxy problem

PostPosted: Thu Jul 30, 2009 7:16 am
by JonP
First I must say how impressed I am with the capabilities of this system.

But I do have one very significant problem. On my Mac all works well - but the PHP setup on my server requires a proxy routing internally to route from one Apache server to another. It is not practical at this time to change that approach for many reasons.

The result is that the first page comes up beautifully - but clicking on anything except a second table tab results in a "not found" error because the base URL is now wrong.

For example from the opening page, clicking on the "product" tab results in the URL http://192.168.11.4:89/demoxataface/ind ... le=product which works fine. Similarly clicking on any other table tab on that screen uses the correct URL. If I click on one of the displayed products, an incorrect URL is used i.e. http://127.0.0.1:8000/demoxataface/inde ... -mode=list which reflects the internal proxy mechanism. Manually changing the "127..." bit to the "real" IP "192..." corrects the problem and the correct page is displayed. But of course that is not a practical approach.

Any suggestions on how to fix this?


Jon P.

PostPosted: Thu Jul 30, 2009 12:08 pm
by shannah
At the beginning of your index.php file, add the following for testing:
print_r($_SERVER);

Notice any place where it references 127.0.0.1 and change them to 192.168.11.4
And any references to 8000 and change them to 89.

E.g. at the beginning of your index.php you might have something like:

$_SERVER['HTTP_HOST'] = '192.168.11.4'

etc...

-Steve

PostPosted: Thu Jul 30, 2009 12:09 pm
by shannah
Also can you give me a readout of your $_SERVER dump. XXX out any sensitive information. I just want to see if there are any clues in there that might allow us to detect this situation out of the box with xataface so you wouldn't have to make this correction.

-Steve

PostPosted: Thu Jul 30, 2009 12:47 pm
by JonP
shannah wrote:Also can you give me a readout of your $_SERVER dump. XXX out any sensitive information. I just want to see if there are any clues in there that might allow us to detect this situation out of the box with xataface so you wouldn't have to make this correction.

-Steve


Thanks for the replay Steve. Here is the content of the $_SERVER

Array ( [HTTP_HOST] => 127.0.0.1:8000 [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5 [HTTP_ACCEPT_ENCODING] => gzip,deflate [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 [HTTP_COOKIE] => PHPSESSID=h6jgdv6kiai4rd4pkuije26k73; ZDEDebuggerPresent=php,phtml,php3; dataface__lang=en [HTTP_MAX_FORWARDS] => 10 [HTTP_X_FORWARDED_FOR] => 192.168.11.239 [HTTP_X_FORWARDED_HOST] => 192.168.11.4:89 [HTTP_X_FORWARDED_SERVER] => xxxxx.xxxxx.xxxx.xxx.COM [HTTP_CONNECTION] => Keep-Alive [PATH] => /QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin [SERVER_SIGNATURE] =>
Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7d Zend Core/2.6.1 PHP/5.2.6 Server at 127.0.0.1 Port 8000
[SERVER_SOFTWARE] => Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7d Zend Core/2.6.1 PHP/5.2.6 [SERVER_NAME] => 127.0.0.1 [SERVER_ADDR] => 127.0.0.1 [SERVER_PORT] => 8000 [REMOTE_ADDR] => 127.0.0.1 [DOCUMENT_ROOT] => /www/zendcore/htdocs [SERVER_ADMIN] => you@example.com [SCRIPT_FILENAME] => /www/zendcore/htdocs/demoxataface/index.php [REMOTE_PORT] => 37487 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /demoxataface/index.php [SCRIPT_NAME] => /demoxataface/index.php [PHP_SELF] => /demoxataface/index.php [REQUEST_TIME] => 1248957052 [argv] => Array ( ) [argc] => 0 )

I don't know how reliable it is but the [HTTP_X_FORWARDED_HOST] => 192.168.11.4:89 information is present in each of the dumps.

I added

$_SERVER[HTTP_HOST] = $_SERVER[HTTP_X_FORWARDED_HOST];

to the index.php and it appears to work correctly if I do that. I won't be able to investigate fully until I can set this up on another similar system as I lose access to this one in about 15 minutes.