Nginx - API Gateway is not forwarding the request to Auth Service
zaidahmd
nginx-forum at forum.nginx.org
Tue Apr 11 06:04:32 UTC 2017
Hi Maxim,
Thanks for the response.
As you said below,
> Instead, it issues a
> subrequest for every incoming request, and allows further
> processing of the request if and only if the subrequest returns
> 200.
This means my authentication service will be getting a subrequest to /login
everytime a request reaches nginx. And if the subrequest returns 401 then it
means the user needs to login. So kindly help me that how can I show a login
page if a subrequest throws 401 ? My authentication service is sending a
redirect in response alongwith the 401 status?
When I access my authentication service directly from browser without a
logged-in session id, my browser is getting a 401 with redirect to /login
which is login page. I want this same behaviour in my NGINX API gateway i.e.
NGINX sends each request to API gateway if the request needs to be logged in
a login page should be shown otherwise let the request access the resource.
And I followed the nginx auth_request user guide to configure this as I
showed my config in first thread.
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,273515,273523#msg-273523
More information about the nginx
mailing list