You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Shiva Kumar K R <sh...@securelyshare.com> on 2018/06/03 06:23:42 UTC

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

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.

Thanks,
Shiva

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

Posted by "Muggeridge, Matt" <ma...@hpe.com>.
> On 3 Jun 2018, at 07:23, Shiva Kumar K R <sh...@securelyshare.com> 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@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


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

Posted by Nick Kew <ni...@apache.org>.
> On 3 Jun 2018, at 07:23, Shiva Kumar K R <sh...@securelyshare.com> 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.

There's no specific JSON parser, unless you can find a third-party module.

But if parsing your POST data as text works, then mod_sed may do the job for you.

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