OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [users@httpd] Modifying request body and content type going to proxy url


> On 3 Jun 2018, at 07:23, Shiva Kumar K R <shiva.k@xxxxxxxxxxxxxxxxx> wrote:
> 
> Hi All,
> I am able to configure httpd as reverse proxy, I have to modify json body in post request coming from client to URL encoded format before sending that to specific proxy server, I have searched for the answer on the internet but got nothing can anyone give a hint on this.

I ended up using "Substitute" rules with my reverse-proxy.  I found I had more control over what needed substituting.

In my case, I needed elaborate rules for substituting strings in complex Javascript, CSS, JNLP and of course HTML.  This is not yet complete, but in case this gives you a few ideas, here is an extract from my VirtualHost section (this much is working so far)...

<Location "/abc/">
            # Rather than using ProxyHTMLURLMap, the substitute module has
            # proven to be more versatile.
            #
            # Add the output filter SUBSTITUTE for each of the specified content types
            AddOutputFilterByType SUBSTITUTE text/javascript text/html text/css
            Substitute "s#(\"|\')/(api|app|images|source|style)#$1/abc/$2#q"

             AddOutputFilterByType SUBSTITUTE application/x-java-jnlp-file
             Substitute "s#codebase=(.*):1443#codebase=$1:443/abc#q"
             Substitute "s#<argument>1443#<argument>443#nq"
</Location>

Matt.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx