httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Reilly <narama...@gmail.com>
Subject [users@httpd] mod_extfilter and environment variables
Date Thu, 21 Feb 2013 02:20:25 GMT
Hello there,

I have a reverse proxy in front of a bunch of applications servers exposing
java web services, and I have a requirement to alter the response xml, I
have been accomplishing this by a series of convoluted filters like the
following:

SetEnvIf HTTPS on https
SetEnvIf HTTPS off http

ExtFilterDefine httpurl1 cmd="/bin/sed 's|http://int-host.
*:9001/internal/url|http://ext-host/external/url|g'" DisableEnv=https
ExtFilterDefine httpsurl1 cmd="/bin/sed 's|http://int-host.
*:9001/internal/url|https://ext-host/external/url|g'" DisableEnv=http
<Location /external/url>
   ProxyPass http://int-host:9001/internal/url
   SetOutputFilter httpurl1;httpsurl1
</Location>

This has been working well but the list of proxied URL's is becoming
quite unwieldy, so in a quest to simplify things, I'm attempting to do the
following:

RewriteMap api_rewrite txt:/etc/httpd/conf/extra/rewritemap.txt

RewriteRule ^(.*) ${api_rewrite:$1} [P]

The rewrite works perfectly, but the problem is that when client
applications/developers download the wsdl the schema (amongst other things)
location points to the internal host. I have been getting around this by
using the filters above, but I would like to simplify things even further
if possible.

The documentaion for mod_extfilters states:
" cmd=cmdline <stuff>
 In addition to the standard CGI environment variables, DOCUMENT_URI,
DOCUMENT_PATH_INFO, and QUERY_STRING_UNESCAPED will also be set for the
program."

Am I correct in thinking that something like this will work, or am
I interpreting the documentation incorrectly (entirely possible, I'm not
that smart):
ExtFilterDefine url1 cmd="/bin/sed s|http://z2esb.
*:9001/internal/url|http://%{HTTP_HOST}/external/url|g"

Thanks for your time, hope it all makes sense.

Nathan.

Mime
View raw message