How to directly return in filter

Maxim Dounin mdounin at mdounin.ru
Fri Aug 1 14:35:03 UTC 2014


Hello!

On Fri, Aug 01, 2014 at 05:56:48PM +0800, Jerry OELoo wrote:

> Hi All:
> I am developing a module in Nginx-1.6.0, Now My module work as a filter.
> 
> static ngx_int_t ngx_http_my_handler(ngx_http_request_t *r)
> {
>      ...
>      return ngx_http_output_filter();
> }
> I use ngx_http_output_filter() to send the response to client.
> 
> Now I want to do some extra thing in my handler, I can get the url
> from ngx_http_request_t, and I want just return some thing if request
> URL is www.aaa.com, but if request URL is www.bbb.com, I do not want
> my handler do anything, and just let client access www.bbb.com page.
> 
> How can I achieve my aim. Thanks!

Evan Miller's guide, as linked from 
http://nginx.org/en/links.html, have a chapter about writing 
filters:

http://www.evanmiller.org/nginx-modules-guide.html#filters

And you may want to read other parts as well.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list