-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to get client ip from request object? #101
Comments
You can check the REMOTE_ADDR header in req.headers . |
can you give this as req.remote_addr ? |
there is no REMOTE_ADDR in req.headers. got only these headers. HOST |
Do you have a line like this in your nginx config?
Gunicorn is HTTP, which means the only information it has access too are the current socket connection and the headers that it receives. In a proxy configuration there's no method for getting the remote IP unless you have the proxy server forward that information in a header. Once in a header it should be in req.headers. If that does not appear to be the case, please open another ticket. |
yes adding the line in nginx helped! |
hi you can get the remote address with req.peer_addr[0],which is connecting with gunicorn directly. |
is it possible to get the client ip address from request object?
def post_request(worker, req):
The text was updated successfully, but these errors were encountered: