oauth2-proxy と Basic 認証を併用する
2020/06/16 01:27:372020/12/18 11:02:42
https://user:pass@hostname
でもアクセスできるようにしたい satisfy any;
user.conf
location /oauth2/ {
proxy_pass http://127.0.0.1:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Auth-Request-Redirect $request_uri;
}
location = /oauth2/auth {
proxy_pass http://127.0.0.1:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header Content-Length "";
proxy_pass_request_body off;
}
location /user {
satisfy any;
auth_basic "Auth";
auth_basic_user_file "/etc/nginx/htpasswd";
auth_request /oauth2/auth;
error_page 401 = /oauth2/sign_in;
}
Generated from
oauth2-proxy と Basic 認証を併用する