git.iko.soy/typeable/oauth2-proxy
on master help sign in
README: simplify nginx auth_request example

/oauth2/auth is not more sensitive than other /oauth2/ paths, does not need "internal" protection "spdy" protocol is obsolete, http2 is the thing to enable now. But it's orthogonal anyway. No need for two separate content/upstream location blocks in this example, reduce to just one, with a comment that it could be serving files instead of proxying.

commit7f5672b433f70478c79fe4f7294a92cb56a0b64b authorPierce Lopez <pierce.lopez@gmail.com> dateMon 24 Apr 2017, 17:56 (10 years ago) parentea2540b
1 file changed+3−14
README.md+3−14
README.md+3−14
@@ -350,15 +350,10 @@ The [Nginx `auth_request` directive](http://nginx.org/en/docs/http/ngx_http_auth
350350
351351```nginx
352352server {
353− listen 443 ssl spdy;
353+ listen 443 ssl;
354354 server_name ...;
355355 include ssl/ssl.conf;
356356
357− location = /oauth2/auth {
358− internal;
359− proxy_pass http://127.0.0.1:4180;
360− }
361−
362357 location /oauth2/ {
363358 proxy_pass http://127.0.0.1:4180;
364359 proxy_set_header Host $host;
@@ -367,7 +362,7 @@ server {
367362 proxy_set_header X-Auth-Request-Redirect $request_uri;
368363 }
369364
370− location /upstream/ {
365+ location / {
371366 auth_request /oauth2/auth;
372367 error_page 401 = /oauth2/sign_in;
373368
@@ -379,13 +374,7 @@ server {
379374 proxy_set_header X-Email $email;
380375
381376 proxy_pass http://backend/;
382− }
383−
384− location / {
385− auth_request /oauth2/auth;
386− error_page 401 = https://example.com/oauth2/sign_in;
387−
388− root /path/to/the/site;
377+ # or "root /path/to/site;" or "fastcgi_pass ..." etc
389378 }
390379}
391380```