you might want to check the lua-module http://wiki.nginx.org/HttpLuaModule
there are a lot of different functions to manipulate each part/phase
of a request; i understand that is, what you want?
if you already use openresty than you'll find lua included in your nginx.
regards,
mex
2014-04-28 8:14 GMT+02:00 Baok Liang <baok...@ericsson.com>:
> Hello,
>
> We are new on Nginx module development. Currently we encounter an issue as below. Could you please help to check? Thanks in advanced.
>
> Scenario:
> add a module to decode/modify parameter on HTTP request. Then pass the updated HTTP request to PHP to be handled as normal.
>
> Question:
> How to modify nginx.conf and how to decode/modify HTTP request?
> Currently, all examples about nginx module I got are nginx module handle HTTP request and then provide response to client directly.
>
>
> nginx.conf
> ...
> location ~ \.php$ {
> fastcgi_split_path_info ^(.+\.php)(/.+)$;
> # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
>
> # With php5-cgi alone:
> fastcgi_pass 127.0.0.1:9000;
> # With php5-fpm:
> fastcgi_pass unix:/var/run/php5-fpm.sock;
> fastcgi_index index.php;
> include fastcgi_params;
> }
>
>
> Regards,
> Baok Liang
> ECN:78574, Phone:020-89678574, Mobile:13922118970
>
>
> -----Original Message-----
> From: Elvis Deng
> Sent: 2014年4月28日 13:26
> To: Baok Liang
> Subject: FW: [openresty-en] How to modify a POST arg within Nginx?
>
> Hi Baok,
>
> Yichun replies the mail. You could talk with him for more information.
>
> Best wishes,
> Elvis Deng
>
> -----Original Message-----
> From: openresty-en@googlegroups.com [mailto:openresty-en@googlegroups.com] On Behalf Of Yichun Zhang (agentzh)
> Sent: 2014年4月28日 13:18
> To: openresty-en
> Subject: Re: [openresty-en] How to modify a POST arg within Nginx?
>
> Hello!
>
> On Sun, Apr 27, 2014 at 9:14 PM, Elvis Deng wrote:
>> I want to modify a POST value in Nginx and then put it back (don’t
>> change its original data flow).
>> Does any existing module do the similar work?
>>
>
> You can use the ngx_lua module for this:
>
> https://github.com/openresty/lua-nginx-module#readme
>
> Basically you'll find the ngx.req.get_body_data() and
> ngx.req.set_body_data() handy :)
>
> Regards,
> -agentzh.