about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-02-26 19:23:14 +0100
committerRory& <root@rory.gay>2024-02-26 19:23:14 +0100
commit1368da6dfb7cf3d5ad2244d740881957a2587cc7 (patch)
tree6a9af5586b3a2be46a55a256aca268234f921a77
parentUse X-Real-IP and X-Forwarded-For if available (diff)
downloadMatrixMediaGate-1368da6dfb7cf3d5ad2244d740881957a2587cc7.tar.xz
Remove debug logging
-rw-r--r--MatrixMediaGate/Services/AuthValidator.cs9
-rw-r--r--MatrixMediaGate/appsettings.Development.json4
2 files changed, 4 insertions, 9 deletions
diff --git a/MatrixMediaGate/Services/AuthValidator.cs b/MatrixMediaGate/Services/AuthValidator.cs
index 28127ae..41c4136 100644
--- a/MatrixMediaGate/Services/AuthValidator.cs
+++ b/MatrixMediaGate/Services/AuthValidator.cs
@@ -15,7 +15,7 @@ public class AuthValidator(ILogger<AuthValidator> logger, ProxyConfiguration cfg
 
     public async Task<bool> UpdateAuth(HttpContext ctx) {
         if (ctx.Connection.RemoteIpAddress is null) return false;
-        var remote = GetRemote(ctx);
+        var remote = GetRemoteAddress(ctx);
         if (string.IsNullOrWhiteSpace(remote)) return false;
 
         if (_authCache.TryGetValue(remote, out var value)) {
@@ -75,12 +75,7 @@ public class AuthValidator(ILogger<AuthValidator> logger, ProxyConfiguration cfg
         }
     }
 
-    private string? GetRemote(HttpContext ctx) {
-        foreach (var (key, value) in ctx.Request.Headers) {
-            Console.WriteLine($"Authorized (ignore me) - Headers: {key}: {value}");
-        }
-
-        // X-Real-IP X-Forwarded-For
+    private string? GetRemoteAddress(HttpContext ctx) {
         if (ctx.Request.Headers.TryGetValue("X-Real-IP", out var xRealIp)) {
             return xRealIp.ToString();
         }
diff --git a/MatrixMediaGate/appsettings.Development.json b/MatrixMediaGate/appsettings.Development.json
index 627ac37..2763a9a 100644
--- a/MatrixMediaGate/appsettings.Development.json
+++ b/MatrixMediaGate/appsettings.Development.json
@@ -8,8 +8,8 @@
     }

   },

   "ProxyConfiguration": {

-    "Upstream": "https://rory.gay",

-    "Host": "matrix.rory.gay",

+    "Upstream": "http://matrix.rory.gay",

+    "Host": "matrix-rory-gay.localhost",

     "TrustedServers": [

       "rory.gay"

     ]