You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Edward Bailey <ed...@gmail.com> on 2011/06/12 22:15:26 UTC

[users@httpd] is it possible to modify the body of a http post using a input filter?

Greetings,

I have been trying without success to create an input filter that would
dynamically modify the body of a http post in order to fix a customer
application issue until DEV can come up with a fix. I have seen very few
examples of anyone using SetInputFilter so I was wondering if I am not
understanding the documentation or the capabilities of an input filter. I
know using a filter is an expensive operation, but this is a low volume
customer and our web servers have plenty of spare resources.

Here are the details and the workflow

We are using RHEL 5.2 httpd 2.2.3-11

If the filter works then mod_proxy would direct the post to the appropriate
application server.

In the virtualhost I have defined the following

##########################################

 ExtFilterDefine route mode=input intype=text/xml cmd="/bin/sed
s/<CustomerId>001500<\/CustomerId>/<CustomerId>001500<\/CustomerId><customerId>001500<\/customerId>/g"

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Order Allow,Deny
        Allow from all
        SetInputFilter route
        ExtFilterOptions LogStderr DebugLevel=2
    </Directory>

##########################################

Is this the correct setup for creating a input filter?

Thanks in advance for any advice. I have never setup an input filter before
so this is a new option for me.

Thanks

Ed

Re: [users@httpd] is it possible to modify the body of a http post using a input filter?

Posted by Edward Bailey <ed...@gmail.com>.
Ok - I will give mod_sed a try though I will have to compile it. Hopefully
it will work in the version of apache. Yeah - i thought that was a bad idea
though putting the config in <Location> did not work either.

Thanks

Ed

On Sun, Jun 12, 2011 at 4:48 PM, Nick Kew <ni...@webthing.com> wrote:

>
> On 12 Jun 2011, at 21:15, Edward Bailey wrote:
>
> > ##########################################
> >
> >  ExtFilterDefine route mode=input intype=text/xml cmd="/bin/sed
> s/<CustomerId>001500<\/CustomerId>/<CustomerId>001500<\/CustomerId><customerId>001500<\/customerId>/g"
>
> Not sure OTTOMH if that should work.  But using the same expression
> with mod_sed would certainly be a far better solution.
>
> > <Directory />
>
> Now that's badly wrong.  You're exposing your entire filesystem
> (GOTO security 101) while at the same time probably not configuring
> the filter to apply to your application.  You should configure the filter
> (mod_sed) in the same scope (likely a <Location>) as the handler
> for your application.
>
> --
> Nick Kew
>
> Available for work, contract or permanent
> http://www.webthing.com/~nick/cv.html
>
>
> ---------------------------------------------------------------------
> 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] is it possible to modify the body of a http post using a input filter?

Posted by Nick Kew <ni...@webthing.com>.
On 12 Jun 2011, at 21:15, Edward Bailey wrote:

> ##########################################
> 
>  ExtFilterDefine route mode=input intype=text/xml cmd="/bin/sed s/<CustomerId>001500<\/CustomerId>/<CustomerId>001500<\/CustomerId><customerId>001500<\/customerId>/g"

Not sure OTTOMH if that should work.  But using the same expression
with mod_sed would certainly be a far better solution.

> <Directory />

Now that's badly wrong.  You're exposing your entire filesystem
(GOTO security 101) while at the same time probably not configuring
the filter to apply to your application.  You should configure the filter
(mod_sed) in the same scope (likely a <Location>) as the handler
for your application.

-- 
Nick Kew

Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html


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