From 01028cb07547e5388bae3d849a6f7e09961922d2 Mon Sep 17 00:00:00 2001
From: makefu <github@syntax-fehler.de>
Date: Fri, 12 Mar 2021 20:27:57 +0100
Subject: [PATCH] ma ham: protect application server from external requests

---
 2configs/home/ham/nginx.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/2configs/home/ham/nginx.nix b/2configs/home/ham/nginx.nix
index 2048ff2..e166b2a 100644
--- a/2configs/home/ham/nginx.nix
+++ b/2configs/home/ham/nginx.nix
@@ -6,5 +6,10 @@ in {
     serverAliases = [ "hass.lan" "ha" "ha.lan" ];
     locations."/".proxyPass = "http://localhost:8123";
     locations."/".proxyWebsockets = true;
+    extraConfig = ''
+      if ( $server_addr != "${internal-ip}" ) {
+        return 403;
+      }
+    '';
   };
 }