Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
ngx.exit(ngx.HTTP_NOT_FOUND) still returns 200 #15
Thanks a lot for all those modules !
I tried to run your example and can't figure how to actually returns a 404 if the key is not found (hence
Any idea by any chance ?
On Mon, Mar 11, 2013 at 12:44 AM, Anthony Scalisi
Tested on my side:
Looking good, huh?
Thanks for the reply @agentzh.
I'm still getting a 200 OK on a key not found in Redis (based on
Please have a look at this snippet, this is the full code:
I'm making sure to strip the leading
You can test in Redis using:
And then using curl:
Thanks a lot in advance!
I just figured it out based on your comments. I indeed call
UPDATED: still getting 200 OK for some reason even removing that top
I see the problem in
but I removed any
I figured it out even though it's not clear to me:
I'm confused regarding ngx.exit.
Per the doc http://wiki.nginx.org/HttpLuaModule#ngx.exit :
It looks like
By default, ngx_lua output response data in a non-buffered manner (in
When you call ngx.say() for the first time, the response header will
Consider the following minimal example:
Accessing /t will yield
Why 200? Because the response header with 200 (the default status
You can change the status code by setting ngx.status before sending
This is documented in the manual for ngx.say and ngx.print:
To quote: "emits arguments concatenated to the HTTP client (as
On Mon, Mar 11, 2013 at 3:39 PM, agentzh firstname.lastname@example.org wrote:
Also, if you check out your nginx's error.log file (please always do
sending out the response status 200
So your ngx.exit() call just complaints about the fact that a response
@HoldSoulSkip You must have sent out the request header earlier (maybe implicitly by calling