You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Doug Strick <do...@gmail.com> on 2014/04/18 00:01:02 UTC

[users@httpd] Re: Conditional response body modification

I've come up with the below config using mod_ext_filter which isn't
desirable, but it's the only thing I've been able to come up with so far.
 It's not working exactly yet.  Any suggestions?


SetEnvIf HTTP_COOKIE "USER_TYPE=test" FILTER=$1


*Inside VirtualHost:*

ExtFilterDefine doug mode=output intype=text/html enableenv=FILTER \

cmd="/bin/bash /apps/httpd/scripts/replace.sh"



<Location />

  SetOutputFilter doug

</Location>



*replace.sh*

#!/bin/bash


/bin/sed -r 's/http\:\/\//https\:\/\//g'


On Wed, Apr 16, 2014 at 10:23 AM, Doug Strick <do...@gmail.com>wrote:

> Hello,
>
> I'm looking for a way to modify the data on outgoing requests
> conditionally.  I've tried using mod_substitute, but that appears to be an
> all or nothing module.  The documentation for mod_filter says it can be
> invoked on environment variables, but it's not exactly clear on the valid
> syntax for those variables.  Basically, I'm looking for a way to change all
> links from HTTP to HTTPS in my outgoing responses for users with a specific
> cookie.  Any suggestions?  Thanks
>

[users@httpd] Re: Conditional response body modification

Posted by Doug Strick <do...@gmail.com>.
> In 2.4, it seems like you should be able to register mod_substitute
> via mod_filter.  mod_filter has a "match" parameter that in 2.4 is an
> ap_expr expression, so it can ready basically anything floating around
> in the server.
>
> mod_filter can be pretty intimidating though.


I really wish I could go to 2.4, but we're stuck with 2.2 due to using
Adobe and Oracle modules that don't support 2.4 yet.  I feel like I'm
really close to coming up with something using mod_parp, but just
can't figure how to use it exactly.  Documentation is clear up until I
get to the API section and that looks like I need good knowledge of
programming to understand.

Re: [users@httpd] Re: Conditional response body modification

Posted by Eric Covener <co...@gmail.com>.
>  Anyone
> have any ideas how I can make the HTTP_COOKIE data available to
> mod_substitute?  Let me know if I'm completely off base here in
> understanding what this module can do as well.  Thanks

In 2.4, it seems like you should be able to register mod_substitute
via mod_filter.  mod_filter has a "match" parameter that in 2.4 is an
ap_expr expression, so it can ready basically anything floating around
in the server.

mod_filter can be pretty intimidating though.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Conditional response body modification

Posted by Doug Strick <do...@gmail.com>.
I wasn't able to come up with anything further on the mod_ext_filter
solution.  I did come across mod_parp <http://parp.sourceforge.net> (
http://parp.sourceforge.net).  It says it's able to parse the request data
and make it available to other apache modules.  I've gotten it compiled and
enabled on my apache, but I'm not sure I'm understanding how to pull the
data into mod_substitute.  Anyone have any ideas how I can make the
HTTP_COOKIE data available to mod_substitute?  Let me know if I'm
completely off base here in understanding what this module can do as well.
 Thanks


        <IfModule mod_parp.c>
          SetEnvIf      HTTP_COOKIE     "(^|)CUST_TYPE=test"   parp
        </IfModule>



On Thu, Apr 17, 2014 at 3:01 PM, Doug Strick <do...@gmail.com>wrote:

> I've come up with the below config using mod_ext_filter which isn't
> desirable, but it's the only thing I've been able to come up with so far.
>  It's not working exactly yet.  Any suggestions?
>
>
> SetEnvIf HTTP_COOKIE "USER_TYPE=test" FILTER=$1
>
>
> *Inside VirtualHost:*
>
> ExtFilterDefine doug mode=output intype=text/html enableenv=FILTER \
>
> cmd="/bin/bash /apps/httpd/scripts/replace.sh"
>
>
>
> <Location />
>
>   SetOutputFilter doug
>
> </Location>
>
>
>
> *replace.sh*
>
> #!/bin/bash
>
>
> /bin/sed -r 's/http\:\/\//https\:\/\//g'
>
>
> On Wed, Apr 16, 2014 at 10:23 AM, Doug Strick <do...@gmail.com>wrote:
>
>> Hello,
>>
>> I'm looking for a way to modify the data on outgoing requests
>> conditionally.  I've tried using mod_substitute, but that appears to be an
>> all or nothing module.  The documentation for mod_filter says it can be
>> invoked on environment variables, but it's not exactly clear on the valid
>> syntax for those variables.  Basically, I'm looking for a way to change all
>> links from HTTP to HTTPS in my outgoing responses for users with a specific
>> cookie.  Any suggestions?  Thanks
>>
>
>