Hello,
I am Sambit , an Software Developer at Moz. ( a startup based out of Seattle ).
We are basically trying to do some kind of authentication/authorization based on the "body" of the request using "auth_request" module of NGINX.
Since the auth_request , uses a fake body , we are not able to read the body at the proxy where the request goes from auth_request.
I tried using "lua" to extract the body , and then call ngx.location.capture , to send it to a proxy where I was able to read the body. But the problem I am facing with this approach is , I am not able to collect the response code ( 200, 401, 403 etc ) from the proxy server in nginx. [ or alteast i am not aware if there is a way by which we can collect the response of proxy_pass in nginx ].
Just wanted to check if there is a way which you might be aware as to how the body of the request be sent in auth_request.
The other approaches that I tried are:
1 - Use "echo_read_request_body" to get the body. Then add it as an header and send. But I realized that proxy_pass and echo cannot be in the same location / . The echo does not take effect.
2 - May be add the body as an header and then invoke auth_request. But the variables declared within lua are not carried over to the normal context.
If anyone could provide help / guidance in this regard will be helpful. I also saw you answer a lot of questions on nginx front in different forums and hence contacted you.
Thanks for the time.
Regards