You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Sergey N. Romanov" <sr...@innter.net> on 2007/02/23 14:56:06 UTC

[users@httpd] mod_rewrite + proxy requests + mod_exf_filter

Hi,

We need system which will make these things :
- user requested url like http://our.server/XYZ/page.html
- rewrite engine should map /XYZ/ to real server name and make proxy
request to http://another.server/page.html
- then output filter should replace any specified content

Sound like very easy... But for any reason this do not work :-(

We have these lines in our vhost config :

ExtFilterDefine fltr mode=output intype=text/html cmd="filter.pl"
SetOutputFilter fltr

RewriteEngine  on
RewriteMap     hpm     prg:map.pl
RewriteRule    ^(.+)$  ${hpm:$1}       [P,L]

Without rewrite engine filter works fine and I can see that content is
changed by filter. But when rewrite engine is activated, then I can see,
that content is not changed.

Can someone explain me why this do not work?


-- 

Best regards,
Sergey N. Romanov

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by "Sergey N. Romanov" <sr...@innter.net>.
> have you tried [P,L,T=text/html]

This do not work.


-- 

Best regards,
Sergey N. Romanov

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by matt farey <ma...@gmail.com>.
have you tried [P,L,T=text/html]


Sergey N. Romanov wrote:
> Hi,
>
> We need system which will make these things :
> - user requested url like http://our.server/XYZ/page.html
> - rewrite engine should map /XYZ/ to real server name and make proxy
> request to http://another.server/page.html
> - then output filter should replace any specified content
>
> Sound like very easy... But for any reason this do not work :-(
>
> We have these lines in our vhost config :
>
> ExtFilterDefine fltr mode=output intype=text/html cmd="filter.pl"
> SetOutputFilter fltr
>
> RewriteEngine  on
> RewriteMap     hpm     prg:map.pl
> RewriteRule    ^(.+)$  ${hpm:$1}       [P,L]
>
> Without rewrite engine filter works fine and I can see that content is
> changed by filter. But when rewrite engine is activated, then I can see,
> that content is not changed.
>
> Can someone explain me why this do not work?
>
>
>   

-- 
Matthew Farey
Web App Sec.
25 The Polygon, Southampton, Hants, SO15 2BP, UK
Phone +44(0)2380 631449



---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by Nick Kew <ni...@webthing.com>.
On Fri, 23 Feb 2007 22:15:01 +0600
"Sergey N. Romanov" <sr...@innter.net> wrote:

> Nick Kew wrote:
> 
> > You want mod_proxy_html for that.
> > See also http://www.apachetutor.org/admin/reverseproxies
> 
> Yes, I see. But this is not exactly that we need.
> In this example I can see that we should specify ProxyPass and
> ProxyHTMLURLMap for each /XYZ/. Right?

Or else use a regexp for /([^/]+)/ to catch them all.

> I'll make filter module with mod_perl and hope that this will solve a
> problem.

Feel free to reinvent the wheel.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by "Sergey N. Romanov" <sr...@innter.net>.
Nick Kew wrote:

> You want mod_proxy_html for that.
> See also http://www.apachetutor.org/admin/reverseproxies

Yes, I see. But this is not exactly that we need.
In this example I can see that we should specify ProxyPass and
ProxyHTMLURLMap for each /XYZ/. Right? But we will have thousands of
/XYZ/. And in this case we should generate apache config some times a
day, reload apache and etc.

I'll make filter module with mod_perl and hope that this will solve a
problem.


-- 

Best regards,
Sergey N. Romanov

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by Nick Kew <ni...@webthing.com>.
On Fri, 23 Feb 2007 21:07:13 +0600
"Sergey N. Romanov" <sr...@innter.net> wrote:


> I'll try to explain...

You want mod_proxy_html for that.
See also http://www.apachetutor.org/admin/reverseproxies


-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by "Sergey N. Romanov" <sr...@innter.net>.
Pid wrote:

>> what you want with a real filter?
> 
> or mod_proxy...

I'll try to explain...

User requested url like http://our.server/XYZ/page.html, we map XYZ to
real server address, get specified page from this server and send
received page to user.
Problem is that page can contain images and another things with / in
path, i.g. <img src="/any.image">, or <a href="/any.link">.
These things will be requested as http://our.server/any.image, i.e.
without /XYZ/ and we can not make correct mapping. As result users will
404 for images etc

Are you sure that mod_proxy will replace / with /XYZ/ ?


-- 

Best regards,
Sergey N. Romanov

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by "Sergey N. Romanov" <sr...@innter.net>.
Hi,

One more thing which I can't understand...

When I make request with any browser (even with lynx), then this do not
work... But when I make request with GET (script from perl lwp-request
package), then this work as should!!! I.e. content filtered. This make
me crazy.

Any ideas?!


-- 

Best regards,
Sergey N. Romanov

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by Pid <p...@pidster.com>.
Nick Kew wrote:
> On Fri, 23 Feb 2007 19:56:06 +0600
> "Sergey N. Romanov" <sr...@innter.net> wrote:
> 
>> Without rewrite engine filter works fine and I can see that content is
>> changed by filter. But when rewrite engine is activated, then I can
>> see, that content is not changed.
>>
>> Can someone explain me why this do not work?
> 
> Yep.  mod_ext_filter is checking the intype before it has that
> information from the proxy.  That's (an instance of) the
> problem mod_filter solves for you.
> 
> Anyway, why are you using mod_ext_filter?  Can't you do
> what you want with a real filter?
> 

or mod_proxy...

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by "Sergey N. Romanov" <sr...@innter.net>.
Nick Kew wrote:

> Yep.  mod_ext_filter is checking the intype before it has that
> information from the proxy.

Thanks for advice!

> Anyway, why are you using mod_ext_filter?  Can't you do
> what you want with a real filter?

I have read mod_filter page at
http://httpd.apache.org/docs/2.2/mod/mod_filter.html
but I can't understand how to create real filter... This should apache
module? Right?


-- 

Best regards,
Sergey N. Romanov

---------------------------------------------------------------------
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] mod_rewrite + proxy requests + mod_exf_filter

Posted by Nick Kew <ni...@webthing.com>.
On Fri, 23 Feb 2007 19:56:06 +0600
"Sergey N. Romanov" <sr...@innter.net> wrote:

> 
> Without rewrite engine filter works fine and I can see that content is
> changed by filter. But when rewrite engine is activated, then I can
> see, that content is not changed.
> 
> Can someone explain me why this do not work?

Yep.  mod_ext_filter is checking the intype before it has that
information from the proxy.  That's (an instance of) the
problem mod_filter solves for you.

Anyway, why are you using mod_ext_filter?  Can't you do
what you want with a real filter?

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

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