Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a proxypass rule in place for my website's support page (www.company.com/support) to redirect to a thirdparty hosted web site (company.custhelp.com)...but the sites link's themselves are all on the seperate domain. Is there a way I can maintain the proxy session so that links clicked within the session also pass through the proxy and maintain the "correct" url that I wish the users to see?

share|improve this question

1 Answer 1

To masquerade the domain, you would use the below rules.

ProxyPass /support http://company.custhelp.com
ProxyPassReverse /support http://company.custhelp.com

Any URI links on the remote site would need to be relative, so that, when clicked, they remain inherently relative to your domain. For example:

<a href="faq.html">

vs.

<a href="http://company.custhelp.com/faq.html">

If for some reason you have no control over the content of the remote site (I don't see why you wouldn't), there is no Apache module that parses pages. You would need to create a script that serves those requests from your server. The script would act as the proxy: fetching the pages from the remote site, parsing the content and rewriting the HTML (URIs) before returning it to the end-user.

There are a handful of challenges that arise when creating this type of script. A couple that come to mind are images and css files. You will need to decide if you will handle serving the images through your site or make the script such that it doesn't rewite image URLs. If the image references are relative, you will need to serve them or make the script such that it rewrites those relative paths with the remote source domain. You will have similar issue with css files. Another is "HTTP_REFERER" rules. While rare, if the remote site has any "HTTP_REFERER" rules, those items won't work.

It certainly is not impossible, but you will need to account for many possibilities.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.