Skip to content

Commit

Permalink
client_ip: fallback to REMOTE_ADDR
Browse files Browse the repository at this point in the history
  • Loading branch information
masenf committed Mar 13, 2024
1 parent 57dfc11 commit 1b6786a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,10 @@ async def on_event(self, sid, data):
}

# Get the client IP
client_ip = environ["asgi.scope"]["client"][0]
try:
client_ip = environ["asgi.scope"]["client"][0]
except (KeyError, IndexError):
client_ip = environ.get("REMOTE_ADDR", "0.0.0.0")

# Process the events.
async for update in process(self.app, event, sid, headers, client_ip):
Expand Down

0 comments on commit 1b6786a

Please sign in to comment.