Filtering requests to another server

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 /...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-13-2005
Kenneth Porter
 
Posts: n/a
Default Filtering requests to another server

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?
  #2 (permalink)  
Old 08-13-2005
Nick Kew
 
Posts: n/a
Default Re: Filtering requests to another server

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
  #3 (permalink)  
Old 08-13-2005
Kenneth Porter
 
Posts: n/a
Default Re: Filtering requests to another server

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>
  #4 (permalink)  
Old 08-13-2005
Nick Kew
 
Posts: n/a
Default Re: Filtering requests to another server

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
  #5 (permalink)  
Old 08-17-2005
Kenneth Porter
 
Posts: n/a
Default Re: Filtering requests to another server

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.
  #6 (permalink)  
Old 08-19-2005
Kenneth Porter
 
Posts: n/a
Default Re: Filtering requests to another server

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.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:21 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0