This is a discussion on Filtering requests to another server within the Linux Web Servers forums, part of the Web Server and Related Forums category; I'm using ExtFilterDefine, SetOutputFilter, and ProxyPass on a server to edit responses coming from another server. Currently I set /...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm using ExtFilterDefine, SetOutputFilter, and ProxyPass on a server to
edit responses coming from another server. Currently I set /etc/hosts on the client to override the default DNS and point it at my web server, then ProxyPass from there to the real server. But it would be nice if I could use the web server that's already on the client. To do that, I'd need to ProxyPass to the IP of the real server (ie. "ProxyPass / http://xx.yy.zz.aa/"). Alas, when I do that, I get "Bad Request (Invalid Hostname)" in my log. Should this work? Or is there something in the way that ProxyPass works that prevents this from happening? I thought Apache just sends the request through with the same Hostname header to the final server. Do I need another filter to insure that? |
|
|||
|
Kenneth Porter wrote:
> I'm using ExtFilterDefine, Ouch. Do you realise quite how inefficient that is? What kind of contents are you filtering? > SetOutputFilter, and ProxyPass on a server to > edit responses coming from another server. Have you read http://www.apacheweek.com/features/reverseproxies ? > Currently I set /etc/hosts on > the client to override the default DNS and point it at my web server, then > ProxyPass from there to the real server. Erm, I'd strongly suggest cutting down the complexity. That sounds like a likely cause of trouble. Alas, when I do that, I get "Bad Request (Invalid > Hostname)" in my log. Sounds like messed up DNS. What you're trying is perfectly standard. Read the above-referenced article. -- Nick Kew |
|
|||
|
Nick Kew <nick@asgard.webthing.com> wrote in news:2a31t2-l4h.ln1
@asgard.webthing.com: > Have you read http://www.apacheweek.com/features/reverseproxies ? Interesting, but I don't think it applies. My situation is that I have an app with a hard-coded URI to a CGI form on an outside server. I want to intercept the requests to that server and modify the responses received. There's no internal URI's to rewrite. Ideally I'd like to do it on the same box that hosts the app. At the moment I'm using the /etc/hosts hack and the separate Apache server. On the app machine I have in /etc/hosts something like "ip-of-my-web-server realserver.com". This fools it into consulting my web server. The separate server is configured like this: LoadModule ext_filter_module modules/mod_ext_filter.so ExtFilterDefine filter-response mode=output cmd="/var/www/filterresponse" <VirtualHost *:80> DocumentRoot /var/www/foo ServerName realserver.com SetOutputFilter filter-response ProxyPass / http://realserver.com/ </VirtualHost> |
|
|||
|
Kenneth Porter wrote:
> Nick Kew <nick@asgard.webthing.com> wrote in news:2a31t2-l4h.ln1 > @asgard.webthing.com: > > >>Have you read http://www.apacheweek.com/features/reverseproxies ? > > > Interesting, but I don't think it applies. Erm, well then, read the docs at apache.org > My situation is that I have an app with a hard-coded URI to a CGI form on > an outside server. I want to intercept the requests to that server and > modify the responses received. There's no internal URI's to rewrite. Fair enough. That's just one of the things discussed in the article, and not relevant to everyone. If it's HTML or XML you're rewriting, there's almost certainly a better solution, but you *still* haven't told us that. > <VirtualHost *:80> > DocumentRoot /var/www/foo > ServerName realserver.com > > SetOutputFilter filter-response > ProxyPass / http://realserver.com/ > </VirtualHost> Hmmm? As in "proxypass to myself in an infinite loop with one link?" -- Nick Kew |
|
|||
|
Nick Kew <nick@asgard.webthing.com> wrote in news:8lc1t2-t0i.ln1
@asgard.webthing.com: > Fair enough. That's just one of the things discussed in the article, > and not relevant to everyone. If it's HTML or XML you're rewriting, > there's almost certainly a better solution, but you *still* haven't > told us that. No, it's some column-formatted text. >> <VirtualHost *:80> >> DocumentRoot /var/www/foo >> ServerName realserver.com >> >> SetOutputFilter filter-response >> ProxyPass / http://realserver.com/ >> </VirtualHost> > > Hmmm? As in "proxypass to myself in an infinite loop with one link?" No. The app thinks it's talking to realserver.com because we fool it with /etc/hosts. The web server, presently on a different host, receives the requests from the app and proxies it to the real server, using DNS to look up the IP. There's no loop. |
|
|||
|
Nick Kew <nick@asgard.webthing.com> wrote in news:8lc1t2-t0i.ln1
@asgard.webthing.com: > Fair enough. That's just one of the things discussed in the article, > and not relevant to everyone. If it's HTML or XML you're rewriting, > there's almost certainly a better solution, but you *still* haven't > told us that. No, it's some column-formatted text. >> <VirtualHost *:80> >> DocumentRoot /var/www/foo >> ServerName realserver.com >> >> SetOutputFilter filter-response >> ProxyPass / http://realserver.com/ >> </VirtualHost> > > Hmmm? As in "proxypass to myself in an infinite loop with one link?" No. The app thinks it's talking to realserver.com because we fool it with /etc/hosts. The web server, presently on a different host, receives the requests from the app and proxies it to the real server, using DNS to look up the IP. There's no loop. |