Sfoglia il codice sorgente

fix(nginx/backend): use 127.0.0.1 instead of localhost to avoid IPv6 issues and harden security

unknown 3 giorni fa
parent
commit
229204fd2b
2 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 1 1
      backend/main.py
  2. 2 2
      nginx.conf

+ 1 - 1
backend/main.py

@@ -174,4 +174,4 @@ async def add_cache_control_header(request, call_next):
 
 if __name__ == "__main__":
     import uvicorn
-    uvicorn.run(app, host="0.0.0.0", port=8000)
+    uvicorn.run(app, host="127.0.0.1", port=8000)

+ 2 - 2
nginx.conf

@@ -14,7 +14,7 @@ server {
 
     # Proxy API requests to backend
     location /api/ {
-        proxy_pass http://localhost:8000/;
+        proxy_pass http://127.0.0.1:8000/;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
     }
@@ -27,7 +27,7 @@ server {
 
     # WebSocket requests
     location /ws/ {
-        proxy_pass http://localhost:8000/;
+        proxy_pass http://127.0.0.1:8000/;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "Upgrade";