~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH meta.sr.ht] Correct value for addr to get real client IP even when behind apache reverse proxy

Details
Message ID
<20200303024532.17623-1-myself@marcg.pizza>
DKIM signature
pass
Download raw message
Patch: +1 -1
---
The audit tab was always showing 127.0.0.1 as the source no matter what.
Tried multiple settings in apache config RemoteIPHeader X-Forwarded-For,RemoteIPHeader X-Real-IP,RemoteIPHeader X-Real-IP,RemoteIPHeader X-Client-IP
All with same reults. Found this solution after much searching.
https://stackoverflow.com/questions/12770950/flask-request-remote-addr-is-wrong-on-webfaction-and-not-showing-real-user-ip#23281516
I don't know if this is ideal or not. Am open to other solutions but this get the correct client/remote IP to show.

 metasrht/audit.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/metasrht/audit.py b/metasrht/audit.py
index f96ad2e..8f35318 100644
--- a/metasrht/audit.py
+++ b/metasrht/audit.py
@@ -10,7 +10,7 @@ def audit_log(event_type, details=None, user=None):
        user = current_user
    if not user:
        return
    addr = request.headers.get("X-Real-IP") or request.remote_addr
    addr = request.access_route[-1]
    event = AuditLogEntry(user.id, event_type, ip_address(addr), details)
    db.session.add(event)

-- 
2.25.1
Details
Message ID
<C16BZ8EIJGBO.SH3KF1Y0YD6O@homura>
In-Reply-To
<20200303024532.17623-1-myself@marcg.pizza> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git.sr.ht:~sircmpwn/meta.sr.ht
   744e3d7..6521a8c  master -> master
Reply to thread Export thread (mbox)