Commit 771b109fe10f673b322026f3b1b7fcf01fa460ce

Thomas de Grivel 2024-09-11T12:59:28

httpd: X-Real-IP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/lib/kc3/0.1/httpd.kc3 b/lib/kc3/0.1/httpd.kc3
index e75627a..89f2a5e 100644
--- a/lib/kc3/0.1/httpd.kc3
+++ b/lib/kc3/0.1/httpd.kc3
@@ -52,12 +52,8 @@ defmodule HTTPd do
         else
           headers = req.headers
           puts(headers)
-          forwarded_for = headers["X-Forwarded-For"]
-          if (forwarded_for) do
-            forwarded_for
-          else
-            client.addr_str
-          end
+          real_ip = headers["X-Real-IP"]
+          if (real_ip) do real_ip else client.addr_str end
         end
         puts("#{res.code} #{client_addr} #{req.method} #{req.url}")
         FD.set_blocking(socket, false)