Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

How to pass first part of route and then the rest of path nginx

$
0
0

I have an auth_request in my /protected/ path. Everything works fine so far. But I want that every request that includes /protected/ for example /protected/application1 and /protected/application2 will be go first through the /protected/ location with the authentication and if this is passed go to the further location.I have this so far but it doesn't seem that the authentication has any impact of the route.So when I call /protected/ everything works as expected, when I call /protected/application1 it doesn't matter if the authentication succeeds or not.

This is part of my config:

   location /protected/application1 {        proxy_set_header X-Real-IP $remote_addr;        proxy_pass http://localhost:4501;    }    location /protected/application2 {        proxy_set_header X-Real-IP $remote_addr;        proxy_pass http://localhost:4502;    }    location /protected/ {        auth_request /auth;        auth_request_set $auth_status $upstream_status;        proxy_set_header X-Real-IP $remote_addr;        proxy_pass http://localhost:4500;    }    location = /auth {        internal;        proxy_pass http://localhost:8081/welcome;        proxy_set_header Content-Length "";        proxy_set_header X-Original-URI $request_uri;    }

Do you have any suggestions?

Thank you very much!


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>