SeaWolf-AI commited on
Commit
dd4b30b
·
verified ·
1 Parent(s): 3e9cee9

per-player backend rate-limit bucket

Browse files
Files changed (1) hide show
  1. server.py +2 -1
server.py CHANGED
@@ -69,7 +69,8 @@ class H(SimpleHTTPRequestHandler):
69
  if not base:
70
  return self._json(503, {"error": "backend not configured"})
71
  u = RC.user_from(self.headers) or "anon"
72
- h = {"Content-Type": "application/json", "X-Backend-Token": BK_TOKEN, "X-VK-Session": ("rt-" + u + "-" + (self.headers.get("X-VK-Session") or ""))[:60]}
 
73
  auth = HF_AUTH2 if base == BACKEND2 else HF_AUTH
74
  if auth:
75
  h["Authorization"] = "Bearer " + auth
 
69
  if not base:
70
  return self._json(503, {"error": "backend not configured"})
71
  u = RC.user_from(self.headers) or "anon"
72
+ h = {"Content-Type": "application/json", "X-Backend-Token": BK_TOKEN, "X-VK-Session": ("rt-" + u + "-" + (self.headers.get("X-VK-Session") or ""))[:60],
73
+ "X-Forwarded-For": "rt-" + u} # per-player rate-limit bucket on the backend (all players share this Space's IP)
74
  auth = HF_AUTH2 if base == BACKEND2 else HF_AUTH
75
  if auth:
76
  h["Authorization"] = "Bearer " + auth