Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Apache Output (rhe4es)

Status
Not open for further replies.

nauliv

Technical User
Feb 7, 2006
40
US
The development framework that we are using for our web development is generating tons of double-spaces and sometimes a bunch of "#" in the pages returned. While we are looking for a fix at the code level, I am trying to find out if there is a way to configure apache to replace certain strings in the pages served. (like replace "<space><space>" with "<space>", and replace "#" with <empty string>).

There are third-party mods to compile manually, with "firewall style" features, but I'm more looking into using the standard packages provided with redhat enterprise.

Configuration:
* Redhat Enterprise ES 4
* Apache/2.0.52
* ColdFusion Application Server MX 6.1

Thanks so much !
 
I experimented with something like this in the past. It may or not be working anymore but it might help you toward your solution. Google the Apache directive for ExtFilterDefine and SetOutputFilter for more details

Apache 2.054 - in the httpd.conf file

add (on one line) replace data/DATA with regular expressions for newline translation and ## translation. I remember there was also some comments on how to patch(hide) the Content-Length: header.

ExtFilterDefine fixdata mode=output intype=text/html cmd="/bin/sed/ s/data/DATA/"

and turn it on - could be at a specific url pattern or global

<Location ~ *.cfm>
SetOutputFilter fixdata
</Location>


By the way, ColdFusion has a setting to Suppress Whitespace generation where cfml tags were in the original source.

<CFPROCESSINGDIRECTIVE
SUPPRESSWHITESPACE="Yes" or "No">
... any CFML tags here ...
</CFPROCESSINGDIRECTIVE>

If this works you got it from jeb beasley, if not I don't know where got it.

Jeb \0
 
Heya!

Actually I went to the exact same conclusion as you.
The documentation for httpd says to add in httpd.conf:

====================
# mod_ext_filter directive to define a filter which
# replaces text in the response
#
ExtFilterDefine fixtext mode=output intype=text/html \

cmd="/bin/sed s/verdana/arial/g"


<Location />

# core directive to cause the fixtext filter to
# be run on output
SetOutputFilter fixtext

</Location>
====================

One more thing needs to be done however, based on default install of RedHat: adding a "LoadModule" directive in httpd.conf for the mod_ext_filter module !

Another open source solution for people wanting to do more of a "application layer firewall", there is mod_security:


Thanks Jeb !

This thread can now be closed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top