mediagoblin-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GMG-Devel] Regarding Bug #5460


From: ayleph
Subject: Re: [GMG-Devel] Regarding Bug #5460
Date: Mon, 19 Dec 2016 18:19:57 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 12/19/2016 11:52 AM, Vijeth T Aradhya wrote:
> Hi,
> 
> I'm new to mediaglobin and it's code structure and usage, and hence I
> wanted to ask which tool I'd have to use to get the IP address of the
> user when he/she posts a form. (/mediaglobin/auth/views.py)
> 
> Thank you,
> Vijeth

Hi Vijeth,

I think you can read the 'remote_addr' value of a request, like
'request.remote_addr'. If you want to write this to your log, you'll
have to add code to do so. You can look at the _log lines in
/mediagoblin/auth/tools.py to see an example of how to do this.

If you're running mediagoblin behind a local proxy, you might just see
127.0.0.1 for the remote_addr. If your proxy is adding X-Forwarded-For
headers, you could try to read those out instead. Here's an example, but
note there's a security concern.

https://stackoverflow.com/questions/12770950/flask-request-remote-addr-is-wrong-on-webfaction-and-not-showing-real-user-ip

-- 
ayleph


reply via email to

[Prev in Thread] Current Thread [Next in Thread]