Reverse Proxy question


(Alderman) #1

Hi all.

 

We have a reverse proxy sending traffic to our squiz installation (just testing at the moment).  The proxy address is correctly caught by squiz and the correct website responds and is loaded.  However, all of the links in menus and pages don't retain the proxy prefix but reverts to a different allowable url for the site (one starting squiz.blah).

 

I have looked at the proxy pages in the online manual but can't say I can see if that would help or not.

 

Any help appreciated.

 

Jeffers.

 

 


(Anthony Barnes) #2

Has the proxy url been applied as a root url to the Matrix system, as well as to the site asset? If not Matrix will only pick a url for dynamic links that is attached to the site asset being accessed (see System Configuration -> System Root Urls & the urls screen for the site asset).


(Alderman) #3

Hi Anthony,

 

Yes the URL has been applied as a root URL.  The site loads with the proxy address in the url bar - but all links under the site still use squiz.blah/sitename- our tech guys said it looked as if Squiz maybe wasn't respecting the X-FORWARDED-HOST header to retain the proxied address in its links.


(Bart Banda) #4

Can you give us some more information on what your proxy address is, what url(s) are applied to the site, and what web paths are applied to the assets links that the page is generating on the front end? 


(David Schoen) #5

Hi Anthony,

 

Yes the URL has been applied as a root URL.  The site loads with the proxy address in the url bar - but all links under the site still use squiz.blah/sitename- our tech guys said it looked as if Squiz maybe wasn't respecting the X-FORWARDED-HOST header to retain the proxied address in its links.

Matrix only looks at the "host" header (not "X-Forwarded-Host") as such it only currently supports proxies that pass through the host header unmodified (e.g. Squid, Varnish, mod_proxy).

 

In more detail the fact that your tech guy is mentioning "X-Forwarded-Host" suggests they want the client to connect to the proxy on proxy.example.com (with a host header of "proxy.example.com") and then have the proxy forward that connection on with a host header of "matrix.example.com" (whatever the DNS name the proxy is connecting to Matrix on) and a "X-Forwarded-Host" header of "proxy.example.com".

 

Because Matrix is ignoring the "X-Forwarded-Host" header you will end up getting links calculated from the hostname ("matrix.example.com") of the Matrix install rather than the domain name the client is connecting to. This type of behaviour can be confirmed by adding a Root URL and a Site Asset with the hostname the proxy is connecting to in Matrix and seeing if connecting via the proxy starts showing that instead.

 

Ideally you can talk to your tech guys to turn off "X-Forwarded-Host" (e.g. with mod_proxy you would turn on ProxyPreserveHost: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost).


(Alderman) #6

Hi David,

 

Thanks for that info - I've passed it on to our network guys.  Fingers crossed.

 

Jeff.


(Alderman) #7

Bart, 
Our proxy is from [background=#ffffff]www.cardiff.ac.uk/research/neuroscience-mental-health to squiz.cardiff.ac.uk/research/neuroscience-mental-health

Under system configuration we have [background=#ffffff]www.cardiff.ac.uk as a root url[/background][/background] - 

The current
web path, for example, to the about-us page under that site contains [background=#ffffff]www.cardiff.ac.uk/research/neuroscience-mental-health/about-us[/size][/background]
 
Cheers,
 
Jeff.


(Alderman) #8

Proxying all working now - we needed netscaler rules for content in _data, _media etc..