proxy radicale directly for the time being

This commit is contained in:
Grigory Shipunov 2025-01-20 17:19:29 +00:00
parent ea75d168e4
commit 3a98bf89b6
3 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,17 @@
{ ... }:
{
services.nginx.upstreams.radicale = {
servers = {
"10.89.88.12:5232" = { };
"[fd31:185d:722f::12]:5232" = { };
};
};
services.nginx.virtualHosts."dav.oxapentane.com" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://radicale/";
};
};
}

49
hosts/cloud/proxy/dav.nix Normal file
View file

@ -0,0 +1,49 @@
{ ... }:
{
services.nginx.upstreams.radicale = {
servers = {
"10.89.88.12:5232" = { };
"[fd31:185d:722f::12]:5232" = { };
};
};
services.nginx.virtualHosts."dav.oxapentane.com" = {
forceSSL = true;
enableACME = true;
locations."/oauth2/" = {
proxyPass = "http://10.89.88.11:4180/";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
'';
};
locations."/oauth2/auth" = {
proxyPass = "http://10.89.88.11:4180";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_set_header Content-Length "";
proxy_pass_request_body off;
'';
};
locations."/" = {
proxyPass = "http://radicale/";
extraConfig = ''
auth_request /oauth2/auth;
error_page 401 =403 /oauth2/sign_in;
auth_request_set $user $upstream_http_x_auth_request_user;
auth_request_set $auth_cookie $upstream_http_set_cookie;
# add_header Set-Cookie $auth_cookie;
proxy_set_header X-Remote-User $user;
proxy_set_header X-User $user;
proxy_set_header X-Real-IP $remote_addr;
'';
};
};
}

View file

@ -2,6 +2,7 @@
{ {
imports = [ imports = [
./auth.nix ./auth.nix
./dav-htaccess.nix
]; ];
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
@ -20,6 +21,10 @@
sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL"; sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
appendHttpConfig = '' appendHttpConfig = ''
proxy_buffers 4 256k;
proxy_buffer_size 128k;
proxy_busy_buffers_size 256k;
### TLS ### TLS
# Add HSTS header with preloading to HTTPS requests. # Add HSTS header with preloading to HTTPS requests.
# Adding this header to HTTP requests is discouraged # Adding this header to HTTP requests is discouraged