From 3a65854339f63818469e850a8764894ba4540451 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 7 Jan 2020 12:55:56 -0600 Subject: [PATCH 1/2] Split organizr-auth into separate conf --- organizr-auth.subfolder.conf.sample | 36 +++++++++++++++++++++++++++++ organizr.subdomain.conf.sample | 20 ++-------------- organizr.subfolder.conf.sample | 21 ++--------------- 3 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 organizr-auth.subfolder.conf.sample diff --git a/organizr-auth.subfolder.conf.sample b/organizr-auth.subfolder.conf.sample new file mode 100644 index 0000000..60c9725 --- /dev/null +++ b/organizr-auth.subfolder.conf.sample @@ -0,0 +1,36 @@ +# To use config this with subfolder proxies: +# Rename this file to organizr-auth.subfolder.conf +# Add one of the auth_request lines from the comments below +# ex: +# auth_request /auth-0; +# +# To use config this with subdomain proxies: +# Rename this file to organizr-auth.subfolder.conf (the subfolder file name is still used) +# Add the following line in your other subdomain proxy configs +# include /config/nginx/proxy-confs/organizr-auth.subfolder.conf; +# Add one of the auth_request lines from the comments below +# ex: +# include /config/nginx/proxy-confs/organizr-auth.subfolder.conf; +# auth_request /auth-0; + +location ~ /auth-([0-9]+) { + internal; + include /config/nginx/proxy.conf; + resolver 127.0.0.11 valid=30s; + set $upstream_organizr organizr; + proxy_pass http://$upstream_organizr:80/api/?v1/auth&group=$1; + proxy_set_header Content-Length ""; + + # Do not uncomment the lines below, these are examples for usue in other proxy configs + #auth_request /auth-0; #=Admin + #auth_request /auth-1; #=Co-Admin + #auth_request /auth-2; #=Super User + #auth_request /auth-3; #=Power User + #auth_request /auth-4; #=User + #auth_request /auth-998; #=Logged In + #auth_request /auth-999; #=Guest +} + +# Optional redirect server authentication errors to organizr authentication page +# NOTE: $server_name must be modified to your public URL when using subdomain proxies +#error_page 401 $scheme://$server_name/?error=$status&return=$request_uri; diff --git a/organizr.subdomain.conf.sample b/organizr.subdomain.conf.sample index 25710e0..d92b2bb 100644 --- a/organizr.subdomain.conf.sample +++ b/organizr.subdomain.conf.sample @@ -28,23 +28,7 @@ server { proxy_pass http://$upstream_organizr:80; } - location ~ /auth-(admin|user) { - # This is used for Organizr V1 - internal; - include /config/nginx/proxy.conf; - resolver 127.0.0.11 valid=30s; - set $upstream_organizr organizr; - proxy_pass http://$upstream_organizr:80/auth.php?$1; - proxy_set_header Content-Length ""; - } + # Optional redirect server errors to organizr error pages + #error_page 400 402 403 404 405 408 500 502 503 504 $scheme://$server_name/?error=$status; - location ~ /auth-([0-9]+) { - # This is used for Organizr V2 - internal; - include /config/nginx/proxy.conf; - resolver 127.0.0.11 valid=30s; - set $upstream_organizr organizr; - proxy_pass http://$upstream_organizr:80/api/?v1/auth&group=$1; - proxy_set_header Content-Length ""; - } } diff --git a/organizr.subfolder.conf.sample b/organizr.subfolder.conf.sample index ee66a12..8a0bba0 100644 --- a/organizr.subfolder.conf.sample +++ b/organizr.subfolder.conf.sample @@ -15,22 +15,5 @@ location / { proxy_pass http://$upstream_organizr:80; } -location ~ /auth-(admin|user) { - # This is used for Organizr V1 - internal; - include /config/nginx/proxy.conf; - resolver 127.0.0.11 valid=30s; - set $upstream_organizr organizr; - proxy_pass http://$upstream_organizr:80/auth.php?$1; - proxy_set_header Content-Length ""; -} - -location ~ /auth-([0-9]+) { - # This is used for Organizr V2 - internal; - include /config/nginx/proxy.conf; - resolver 127.0.0.11 valid=30s; - set $upstream_organizr organizr; - proxy_pass http://$upstream_organizr:80/api/?v1/auth&group=$1; - proxy_set_header Content-Length ""; -} +# Optional redirect server errors to organizr error pages +#error_page 400 402 403 404 405 408 500 502 503 504 $scheme://$server_name/?error=$status; From 3517c46c03a55813c652fef544cf3611bb13cef1 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 7 Jan 2020 13:14:57 -0600 Subject: [PATCH 2/2] Use host instead of server_name --- organizr-auth.subfolder.conf.sample | 4 ++-- organizr.subdomain.conf.sample | 2 +- organizr.subfolder.conf.sample | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/organizr-auth.subfolder.conf.sample b/organizr-auth.subfolder.conf.sample index 60c9725..849b264 100644 --- a/organizr-auth.subfolder.conf.sample +++ b/organizr-auth.subfolder.conf.sample @@ -32,5 +32,5 @@ location ~ /auth-([0-9]+) { } # Optional redirect server authentication errors to organizr authentication page -# NOTE: $server_name must be modified to your public URL when using subdomain proxies -#error_page 401 $scheme://$server_name/?error=$status&return=$request_uri; +# NOTE: $host must be modified to your public URL when using subdomain proxies +#error_page 401 $scheme://$host/?error=$status&return=$request_uri; diff --git a/organizr.subdomain.conf.sample b/organizr.subdomain.conf.sample index d92b2bb..496af32 100644 --- a/organizr.subdomain.conf.sample +++ b/organizr.subdomain.conf.sample @@ -29,6 +29,6 @@ server { } # Optional redirect server errors to organizr error pages - #error_page 400 402 403 404 405 408 500 502 503 504 $scheme://$server_name/?error=$status; + #error_page 400 402 403 404 405 408 500 502 503 504 $scheme://$host/?error=$status; } diff --git a/organizr.subfolder.conf.sample b/organizr.subfolder.conf.sample index 8a0bba0..4cad9f2 100644 --- a/organizr.subfolder.conf.sample +++ b/organizr.subfolder.conf.sample @@ -16,4 +16,4 @@ location / { } # Optional redirect server errors to organizr error pages -#error_page 400 402 403 404 405 408 500 502 503 504 $scheme://$server_name/?error=$status; +#error_page 400 402 403 404 405 408 500 502 503 504 $scheme://$host/?error=$status;