Hi maxim,
After implementing your valuable inputs I came across the following error in my application.
Error: "Request 'GET /login' doesn't match 'POST /login"
this means that nginx is sending GET requests to authentication service.
So the flow is as follows and is according to your valuable feedback.
1. I typed the nginx URL in browser "http://localhost:8180/api"
2. NGINX forwarded the request to "http://localhost:8080/login"
3. I get the above error in my auth service i.e "Request 'GET /login' doesn't match 'POST /login"
This forwarded request to auth service should be a POST login
Alternatively,
if I type "http://localhost:8180/login", which is also a NGINX location, I am able to see login page of my auth service.
I want the same for other nginx locaitons i.e. if the request is not authenticated show login page of auth service. get the user authenticated and then forward the requests to upstream server.