A lua script is being used to look for data stored in redis - it provides some additional processing regarding etags and mime types preventing the basic redis module from being used.
The issue I am experiencing is passing back a 404 error to nginx.conf for error handling. Despite setting status etc. The error does not appear to be caught.
In an ideal world! The following would allow a temporary image to be returned in the event no data can be located in redis.
nginx.conf
location /prefix/ {
content_by_lua_file conf/redis.lua;
error_page 404 = /images/not-available.png;
}
redis.lua
...
local arr, error = red:hgetall(uri)
if not arr then
ngx.log(ngx.ERR, "Redis failed locate uri: "..uri)
ngx.status = 404
return ngx.exit(ngx.HTTP_NOT_FOUND)
end
...