refactor: using cool NixOS option for nginx

This commit is contained in:
efim 2023-10-09 03:16:33 +00:00
parent fe9794a796
commit 7dbcc63394
1 changed files with 1 additions and 5 deletions

View File

@ -103,17 +103,13 @@
lib.mkIf cfg.enable {
proxyPass = "http://127.0.0.1:${toString cfg.port}";
# this is config for websocket
proxyWebsockets = true;
extraConfig = ''
rewrite ^/api/(.*)$ /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Add the following lines for WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
'';
};
};