diff --git a/confs/site/authelia-auth-request.conf b/confs/site/authelia-auth-request.conf index 8e28946..4236af2 100644 --- a/confs/site/authelia-auth-request.conf +++ b/confs/site/authelia-auth-request.conf @@ -21,7 +21,6 @@ proxy_set_header Remote-User $user; proxy_set_header Remote-Groups $groups; proxy_set_header Remote-Name $name; proxy_set_header Remote-Email $email; -# If Authelia returns 401, then nginx redirects the user to the login portal. -# If it returns 200, then the request pass through to the backend. -# For other type of errors, nginx will handle them as usual. +{% if AUTHELIA_MODE == "portal" %} error_page 401 =302 {{ AUTHELIA_BACKEND }}/?rd=$target_url; +{% endif %} diff --git a/docs/environment_variables.md b/docs/environment_variables.md index 0de0491..d4069b0 100644 --- a/docs/environment_variables.md +++ b/docs/environment_variables.md @@ -903,6 +903,12 @@ Default value : Context : *global*, *multisite* The private Authelia address when doing requests from nginx (e.g. : http://my-authelia.local:9091). +`AUTHELIA_MODE` +Values : *portal* | *auth-basic* +Default value : *portal* +Context : *global*, *multisite* +Choose authentication mode : show a web page (`portal`) or a simple auth basic prompt (`auth-basic`). + ## misc `SWARM_MODE` diff --git a/settings.json b/settings.json index b771b58..69dff66 100644 --- a/settings.json +++ b/settings.json @@ -87,6 +87,15 @@ "label": "Address of the authelia upstream", "regex": ".*", "type": "text" + }, + { + "context": "multisite", + "default": "portal", + "env": "AUTHELIA_MODE", + "id": "authelia-mode", + "label": "Show the portal or simply auth basic prompt", + "regex": "^(portal|auth\\-basic)$", + "type": "text" } ] },