Feedback on my module

Sirsiwal, Umesh usirsiwal at verivue.com
Sat Apr 2 08:29:47 MSD 2011


agentzh,
I knew I should have tested this sample before posting it :(

Not a Lua expert yet.
-Umesh
________________________________________
From: agentzh [agentzh at gmail.com]
Sent: Friday, April 01, 2011 11:50 PM
To: nginx-devel at nginx.org
Cc: Sirsiwal, Umesh
Subject: Re: Feedback on my module

On Fri, Apr 1, 2011 at 10:44 PM, Umesh Sirsiwal <usirsiwal at verivue.com> wrote:
> Hey Tarek,
> You can use combination of nginx_memc (http://wiki.nginx.org/HttpMemcModule)
> and nginx_lua (https://github.com/chaoslawful/lua-nginx-module) to achieve
> the same result.
>
> Here is an example:
>

Well, there's just some small grammatical errors in the code sample ;)

> location /blah {
>         rewrite_by_lua '
>           if($http_x_target_service == nil) then

if ngx.var.http_x_target_service == nil then

>               return
>           end
>           local res = ngx.location.capture("/memc/$http_x_target_service")
>
>             if res.status != ngx.HTTP_OK then

if res.status ~= ngx.HTTP_OK then

>                       ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE)
>               return
>           end
>           if(res.body != "up") then

if res.body ~= "up" then

>               ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE)
>               return

There's no effect to explicitly "return" when ngx.exit() is used
because ngx.exit() will never return back ;)

>           end
>         ';
>

Anyway, thank you for your code sample, Umesh :)

Cheers,
-agentzh



More information about the nginx-devel mailing list