Skip to content

Instantly share code, notes, and snippets.

View col-panic's full-sized avatar
⛰️

Marco Descher col-panic

⛰️
View GitHub Profile
@col-panic
col-panic / oauth2-proxy+nginx+locationrole.md
Last active January 22, 2024 09:21
Oauth2-proxy + nginx auth_request + limit location for a specific role

This is a full example for running an oauth2-proxy covered by a nginx as reverse proxy, using the auth_request parameter in combination with a required role to mach a location. See oauth2-proxy/oauth2-proxy#1614 for discussion.

Suppose we have Location (A) that should allow access only to users having role roleA

location ^~ /roleAOnly/ {
    auth_request /oauth2/auth/rolea;
 error_page 401 = /oauth2/sign_in;

Keybase proof

I hereby claim:

  • I am col-panic on github.
  • I am marcodescher (https://keybase.io/marcodescher) on keybase.
  • I have a public key ASC9CD0UXibvusVGXdn3jXxpwBUTBM0TfGQ4PF5A0X-jMgo

To claim this, I am signing this object: