nginx: add phpForwardAuth
This commit is contained in:
parent
edce2b26ad
commit
50877bfe4c
3 changed files with 16 additions and 0 deletions
|
|
@ -1163,6 +1163,9 @@
|
||||||
"blocks-nginx-options-shb.nginx.vhosts._.extraConfig": [
|
"blocks-nginx-options-shb.nginx.vhosts._.extraConfig": [
|
||||||
"blocks-nginx.html#blocks-nginx-options-shb.nginx.vhosts._.extraConfig"
|
"blocks-nginx.html#blocks-nginx-options-shb.nginx.vhosts._.extraConfig"
|
||||||
],
|
],
|
||||||
|
"blocks-nginx-options-shb.nginx.vhosts._.phpForwardAuth": [
|
||||||
|
"blocks-nginx.html#blocks-nginx-options-shb.nginx.vhosts._.phpForwardAuth"
|
||||||
|
],
|
||||||
"blocks-nginx-options-shb.nginx.vhosts._.ssl": [
|
"blocks-nginx-options-shb.nginx.vhosts._.ssl": [
|
||||||
"blocks-nginx.html#blocks-nginx-options-shb.nginx.vhosts._.ssl"
|
"blocks-nginx.html#blocks-nginx-options-shb.nginx.vhosts._.ssl"
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,12 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
phpForwardAuth = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Authelia rule configuration";
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = lib.mkOption {
|
extraConfig = lib.mkOption {
|
||||||
type = lib.types.lines;
|
type = lib.types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
|
@ -203,6 +209,10 @@ in
|
||||||
error_page 403 = ${c.authEndpoint}/error/403;
|
error_page 403 = ${c.authEndpoint}/error/403;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
locations."~ \\.php$".extraConfig = lib.mkIf (c.phpForwardAuth) ''
|
||||||
|
fastcgi_param HTTP_X_FORWARDED_USER $user;
|
||||||
|
fastcgi_param HTTP_X_FORWARDED_GROUPS $groups;
|
||||||
|
'';
|
||||||
|
|
||||||
# Virtual endpoint created by nginx to forward auth requests.
|
# Virtual endpoint created by nginx to forward auth requests.
|
||||||
locations."/authelia".extraConfig = lib.mkIf (!(isNull c.authEndpoint)) ''
|
locations."/authelia".extraConfig = lib.mkIf (!(isNull c.authEndpoint)) ''
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,9 @@ so it involves more hops than a direct [OIDC integration](blocks-authelia.html#b
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If PHP is used with fastCGI,
|
||||||
|
extra headers must be added by enabling the [`shb.nginx.vhosts.*.phpForwardAuth`](#blocks-nginx-options-shb.nginx.vhosts._.phpForwardAuth) option.
|
||||||
|
|
||||||
### Virtual Host Extra Config {#blocks-nginx-usage-extraconfig}
|
### Virtual Host Extra Config {#blocks-nginx-usage-extraconfig}
|
||||||
|
|
||||||
To add extra configuration to a virtual host,
|
To add extra configuration to a virtual host,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue