Parse JSON POST request into nginx variable

datanasov nginx-forum at
Fri Mar 27 08:21:28 UTC 2015

justink101 Wrote:
> How can I read a POST request body which is JSON and get a property? 
> I need to read a property and use it as a variable in proxy_pass.
> Pseudo code:
>    $post_request_body = '{"account": "",
> "more-stuff": "here"}';
>    // I want to get
>    $account = "";
>    proxy_pass $account/rest/of/url/here;

I'v wrote a simple configuration example with LUA script to process posted
JSON body and based on KEY/Value take a different action:
/you can find it here:

Posted at Nginx Forum:,250864,257712#msg-257712

More information about the nginx mailing list