I have a content_by_lua in my config file that calls a function do_stuff() in a lua file.
The function essentially calls ngx.location.capture and I have the config file that points the uri of the ngx.location.capture to a backend server:
So in my lua function I have:
local function do_stuff()
.......
local res = ngx.location.capture('/upload_bridge', ...) --- a table is returned here
return res -- cannot just return the res?
end
And in config file I have a location block:
location /upload_bridge {
proxy_pass http://localhost:8080/api/episode/upload/show;
}.
It all works nicely except that I cannot seem to pass the result from the backend server to the client. I can see that the 'res' variable returned from ngx.location.capture('/upload_bridge', ...) is a table that has the proper status, headers, ... etc. But I cannot simply return this resultant table in my function to let nginx forward it back to the client.
Thanks for any help.