Ask for help - Nginx module - how to add a module to decode/modify parameter on HTTP request

55 views
Skip to first unread message

Baok Liang

unread,
Apr 28, 2014, 2:14:53 AM4/28/14
to openre...@googlegroups.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: openre...@googlegroups.com [mailto:openre...@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

--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mex

unread,
Apr 28, 2014, 6:59:05 PM4/28/14
to openre...@googlegroups.com
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

冠胜

unread,
Apr 28, 2014, 10:57:30 PM4/28/14
to openresty-en

Yichun Zhang (agentzh)

unread,
Apr 29, 2014, 2:54:27 PM4/29/14
to openresty-en
Hello!

On Mon, Apr 28, 2014 at 7:57 PM, 冠胜 wrote:
> We are new on Nginx module development. Currently we encounter an issue as
> below. Could you please help to check? Thanks in advanced.
>

Please do not post the same question repeatedly. This is very annoying
and impolite.

You also seem to ignore both mex's and my responses to your earlier
posts. For example,

https://groups.google.com/d/msg/openresty-en/bVH-eDA8wYo/W2VByofkWAEJ

If you keep doing this, I'll have no choice but ban you from this list.

-agentzh
Reply all
Reply to author
Forward
0 new messages