grace/dots

dotfiles/nix configs

git clone https://git.gae.moe/grace/dots

Grace Yoderi gotta stop doing these massive changesb70d9f9

main
1.4 KiB45 linesraw
1{ }:
2
3let
4  authLocation = endpoint: {
5    proxyPass = "http://127.0.0.1:9091/api/authz/${endpoint}";
6    recommendedProxySettings = false;
7    extraConfig = ''
8      internal;
9      auth_request off;
10      proxy_pass_request_body off;
11      proxy_set_header Content-Length "";
12      proxy_set_header Connection "";
13      proxy_set_header X-Original-URL $scheme://$host$request_uri;
14      proxy_set_header X-Original-Method $request_method;
15      proxy_set_header X-Forwarded-For $remote_addr;
16      proxy_set_header Cookie $http_cookie;
17      proxy_set_header Authorization $http_authorization;
18    '';
19  };
20in
21{
22  locations = {
23    "= /_authelia" = authLocation "auth-request";
24    "= /_authelia_git" = authLocation "git";
25  };
26
27  browser = ''
28    auth_request /_authelia;
29    auth_request_set $auth_redirect $upstream_http_location;
30    error_page 401 =302 $auth_redirect;
31    auth_request_set $auth_user $upstream_http_remote_user;
32    auth_request_set $auth_groups $upstream_http_remote_groups;
33    auth_request_set $auth_email $upstream_http_remote_email;
34    auth_request_set $auth_name $upstream_http_remote_name;
35    proxy_set_header Remote-User $auth_user;
36    proxy_set_header Remote-Groups $auth_groups;
37    proxy_set_header Remote-Email $auth_email;
38    proxy_set_header Remote-Name $auth_name;
39  '';
40
41  git = ''
42    auth_request /_authelia_git;
43    proxy_set_header Authorization "";
44  '';
45}