You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike Soultanian <ms...@csulb.edu> on 2009/02/05 09:15:37 UTC

[users@httpd] port issue with reverse proxy

Per my initial requirements, I was able to get reverse proxy working 
pretty well so my legacy web app sees every request originating from 
itself.  To do this, I'm using the following:

proxyrequests off

NameVirtualHost *:80
NameVirtualHost myserver.tld:81

<VirtualHost *:80>
ProxyPass / http://myserver.tld:81/
ProxyPassReverse / http://myserver.tld:81/
</VirtualHost>

<VirtualHost myserver.tld:81>
DocumentRoot c:\inetpub\wwwroot
</VirtualHost>

The only problem now is that new links within the app are getting 
created with :81 appended to the URL.  Unfortunately I can't change how 
the app works so I wanted to see if there is some way to report the port 
as 80 so subsequently selected links will be forced back through the 
first virtualhost like the initial request.  Sound possible?

Thanks!
Mike

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] port issue with reverse proxy

Posted by Mike Soultanian <ms...@csulb.edu>.
Torsten Foertsch wrote:
> If you look for something that follows your HTML more closely have a 
> look at mod_proxy_html (http://apache.webthing.com/mod_proxy_html/). It 
> can distinguish between


Ok, after a LOT of futzing around with other ideas and examples, I 
tweaked another example off the web that *kinda* works:

NameVirtualHost *

<VirtualHost *>
  ServerName externalserver.tld:80
  DocumentRoot c:\inetpub\wwwroot

ProxyRequests off

ProxyPass /info/ http://internalserver.tld:81/
ProxyHTMLURLMap http://internalserver.tld:81 /info
<Location /info/>
   ProxyPassReverse /
   SetOutputFilter proxy-html
   ProxyHTMLURLMap /          /info/
   ProxyHTMLURLMap /info      /info
   RequestHeader    unset  Accept-Encoding
</Location>
</VirtualHost>

I copied this from a site that explained how to do it.  The problem is 
that I don't want to reverse proxy myserver.tld/info, I want to reverse 
proxy everything that goes to myserver.tld (i.e. http://myserver.tld/) 
over to port 81 but have it seen on the external side as myserver.tld.

Or, another example would be to have something like external.tld reverse 
proxy to internal.tld:8086 but have all the links contain external.tld. 
  It seems like all the examples focus on situations where your reverse 
proxying external.tld/wiki to one server, external.tld/blog to another 
and so forth.  I want to reverse proxy everything to one server.

Hopefully that makes sense.

Thanks!
Mike

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] port issue with reverse proxy

Posted by Torsten Foertsch <to...@gmx.net>.
On Thu 05 Feb 2009, André Warnier wrote:
> Mike Soultanian wrote:
> > André Warnier wrote:
> >> I mean, if in your browser you get such a response page, and look
> >> at the html source of the page, do you really see links to
> >> "http://myserver.tld:81/...", or are they more like
> >
> > yup.. that's exactly what I'm getting :(
>
> Well, if all the links are like that, then I just happened to see a
> module in the standard Apache module list, which replaces strings
> on-the-fly. I don't recall the name , but it's an output filter and
> it must be mod_replace, or mod_substitute or something like that.

You mean mod_substitute. It is available only since 2.2.7.

If you look for something that follows your HTML more closely have a 
look at mod_proxy_html (http://apache.webthing.com/mod_proxy_html/). It 
can distinguish between

  <a href="http://myserver.tld:81/...">

and

  <p>http://myserver.tld:81/...</p>

Torsten

-- 
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] port issue with reverse proxy

Posted by André Warnier <aw...@ice-sa.com>.
Mike Soultanian wrote:
> 
> 
> André Warnier wrote:
> 
>> I mean, if in your browser you get such a response page, and look at 
>> the html source of the page, do you really see links to 
>> "http://myserver.tld:81/...", or are they more like 
> 
> 
> yup.. that's exactly what I'm getting :(
> 
Well, if all the links are like that, then I just happened to see a 
module in the standard Apache module list, which replaces strings 
on-the-fly. I don't recall the name , but it's an output filter and it 
must be mod_replace, or mod_substitute or something like that.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] port issue with reverse proxy

Posted by Mike Soultanian <ms...@csulb.edu>.

André Warnier wrote:

> I mean, if in your browser you get such a response page, and look at the 
> html source of the page, do you really see links to 
> "http://myserver.tld:81/...", or are they more like 


yup.. that's exactly what I'm getting :(

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] port issue with reverse proxy

Posted by André Warnier <aw...@ice-sa.com>.
Mike Soultanian wrote:
> Per my initial requirements, I was able to get reverse proxy working 
> pretty well so my legacy web app sees every request originating from 
> itself.  To do this, I'm using the following:
> 
> proxyrequests off
> 
> NameVirtualHost *:80
> NameVirtualHost myserver.tld:81
> 
> <VirtualHost *:80>
> ProxyPass / http://myserver.tld:81/
> ProxyPassReverse / http://myserver.tld:81/
> </VirtualHost>
> 
> <VirtualHost myserver.tld:81>
> DocumentRoot c:\inetpub\wwwroot
> </VirtualHost>
> 
> The only problem now is that new links within the app are getting 
> created with :81 appended to the URL.  Unfortunately I can't change how 
> the app works so I wanted to see if there is some way to report the port 
> as 80 so subsequently selected links will be forced back through the 
> first virtualhost like the initial request.  Sound possible?
> 
Hi.
(I'm no expert, just following this to try and understand it myself)
Looking at : 
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreverse
it seems to concern only HTTP re-direct headers, not links within the 
html pages themselves.
Does your app really generate absolute links within the html response 
pages themselves ?
I mean, if in your browser you get such a response page, and look at the 
html source of the page, do you really see links to 
"http://myserver.tld:81/...", or are they more like 
"/something/something_else", or even relative like "images/img1.gif" ?
If they are really absolute to "http://..", then you might need the 
mod_proxy_html module, as also indicated in the above doc. section.
But otherwise, maybe you are just being confused between what the 
browser does to interpret relative links and what the server actually does ?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org