Jump to content

Recommended Posts

I'm trying to load a website on a different domain through my own domain.  The reason I am trying this is here in this stackoverflow question

 

The problem in the SO question above is that I can't monitor where the user on my domain is going on the remote domain (which is displayed in an iframe on my domain), and my client requires that I do so using Javascript.

 

 

ReverseProxy.png<br/>

Above diagram gleaned from text from here.

 

I researched this a bit (see above), and found that you can setup your apache2 server as a reverse proxy,

 

to request html pages from the remote domain under the apache2 and the browser will view this as coming from my domain.

 

(Thus resolving the whole inability to monitor which pages in the remote site they are visiting; in the browser in Javascript)

 

I have successfully setup my domain's apache2 instance with the mod_proxy_html.so module, and I can check the location of the iframe successfully upon the first load-up of the page

*see snippet of httpd.conf below:*

 

    
    #Load Files needed for proxy_html_module
    
    LoadModule  proxy_module         modules/mod_proxy.so
    LoadModule  proxy_http_module    modules/mod_proxy_http.so
    #LoadModule proxy_ftp_module     modules/mod_proxy_ftp.so
    #LoadModule proxy_connect_module modules/mod_proxy_connect.so
    LoadModule  headers_module       modules/mod_headers.so
    LoadModule  deflate_module       modules/mod_deflate.so
    #LoadFile "/mod_proxy_html/zlib1.dll"
    #LoadFile "/mod_proxy_html/iconv.dll"
    LoadFile "/mod_proxy_html/libxml2.dll"
    LoadModule proxy_html_module     modules/mod_proxy_html.so
    
    ProxyRequests Off
    ProxyPass /my-gateway/ http://example.system.com/
    
    
    <Location /my-gateway>
    	ProxyPassReverse /
    	ProxyHTMLEnable On
    	ProxyHTMLURLMap http://example.system.com /my-gateway
    	ProxyHTMLURLMap / /my-gateway/
    	ProxyHTMLLinks	a		href
    	ProxyHTMLLinks	area		href
    	ProxyHTMLLinks	link		href
    	ProxyHTMLLinks	img		src longdesc usemap
    	ProxyHTMLLinks	object		classid codebase data usemap
    	ProxyHTMLLinks	q		cite
    	ProxyHTMLLinks	blockquote	cite
    	ProxyHTMLLinks	ins		cite
    	ProxyHTMLLinks	del		cite
    	ProxyHTMLLinks	form		action
    	ProxyHTMLLinks	input		src usemap
    	ProxyHTMLLinks	head		profile
    	ProxyHTMLLinks	base		href
    	ProxyHTMLLinks	script		src for
    	
    	ProxyHTMLLogVerbose On
    	
    </Location>
    
    <Location /my-gateway/>
    	
    	ProxyPassReverse /
    	ProxyHTMLEnable On
    	ProxyHTMLURLMap / /my-gateway/
    	ProxyHTMLLinks	a		href
    	ProxyHTMLLinks	area		href
    	ProxyHTMLLinks	link		href
    	ProxyHTMLLinks	img		src longdesc usemap
    	ProxyHTMLLinks	object		classid codebase data usemap
    	ProxyHTMLLinks	q		cite
    	ProxyHTMLLinks	blockquote	cite
    	ProxyHTMLLinks	ins		cite
    	ProxyHTMLLinks	del		cite
    	ProxyHTMLLinks	form		action
    	ProxyHTMLLinks	input		src usemap
    	ProxyHTMLLinks	head		profile
    	ProxyHTMLLinks	base		href
    	ProxyHTMLLinks	script		src for
    	
    </Location>

 

However, I cannot seem to get the links re-written within the page requested from the remote domain that displays in the iframe, thus rendering any links clicked within the iframe requested from the remote domain instead of my domain through the proxy. 

 

What do I need to change to make the src and action html tag attributes be re-written so that they go through the proxy when a user clicks a link or submits a form?  As I thought this would have been covered by the ProxyHTMLLinks directives.

 

 

Link to comment
https://forums.phpfreaks.com/topic/192677-reverse-proxy-with-proxy_html_module/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.