added extra config to services

This commit is contained in:
Leyla Becker 2025-03-07 18:18:37 -06:00
parent 62abf65e5a
commit 8b39a80849
3 changed files with 56 additions and 1 deletions

View file

@ -18,10 +18,15 @@ in {
{
services.home-assistant = {
enable = true;
extraComponents = [
"esphome"
"met"
"radio_browser"
];
config.http = {
server_port = 8082;
use_x_forwarded_for = true;
trusted_proxies = ["127.0.0.1"];
trusted_proxies = ["127.0.0.1" "::1"];
ip_ban_enabled = true;
login_attempts_threshold = 10;
};
@ -29,6 +34,18 @@ in {
host = {
reverse_proxy.subdomains.${config.host.home-assistant.subdomain} = {
target = "http://localhost:${toString config.services.home-assistant.config.http.server_port}";
websockets = true;
extraConfig = ''
add_header Upgrade $http_upgrade;
add_header Connection \"upgrade\";
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 90;
'';
};
};
}