Feedback on my module
agentzh
agentzh at gmail.com
Sat Apr 2 07:50:42 MSD 2011
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