nginxinc / nginx-openid-connect

Reference implementation of OpenID Connect integration for NGINX Plus
https://www.nginx.com/products/nginx/
Other
199 stars 94 forks source link

Question: OIDC optional per location or source IP #42

Closed hammondr closed 3 years ago

hammondr commented 3 years ago

Is it possible to enforce client OIDC authentication only for some location(s)? In my use case, I would like to require OIDC authentication for browser users but allow calls to location /rest to pass through to the upstream server without redirect.

lcrilly commented 3 years ago

Yes, of course. Any location without the OIDC configuration will behave just the way you configure them. NGINX location blocks are selected by most specific match, so your location /rest example will take precedence over location /. See http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration