I have a server where I run multiple subdomains sites with nginx
each subdomain have a server { ... }
block in configuration (in sites-enabled
)
I want to add a global dynamic authentication backend (another http site) that will check requested subdomain and give access or ask user credentials
so the flow should be like
request stie1.example.com ---> [auth check in database] / \ no yes / \ show username/pass form pass to site1.example.com
I found auth_request module - but examples only about server
context
and I want it on top level context (http
context) - where of course location
directive is not available
So basically what I want is sort of global nginx middleware where I can run some code (i.e. python) to check if user have permission to view one of the hosted domains
any suggestions ?
1 Answers
Answers 1
It would perhaps help if you provide actual context for what it is exactly that you want done.
As per http://nginx.org/r/auth_request, the auth_request
directive is actually allowed "two" levels up of the location
context — both in the server
as well as http
contexts, so, there is absolutely nothing that should prevent you from enabling it globally for every single server
in your nginx instance.
Otherwise, if you want it enabled only within certain location
directives and/or only certain server
configurations, then you can always use the include
directive in any context, as per http://nginx.org/r/include.
0 comments:
Post a Comment