gunicorn
gunicorn copied to clipboard
add attribute remote_addr to req object
Hi benotic: as I come from uvicorn, and we are running gunicorn + django behind nginx,so I think it is more convenient for people to get the remote address with request.remote_addr than the raw REMOTE_ADDR.I hope you consider my suggestions and approve it. PS: I use the pre_request to add some request headers based on the remote address.Uvicorn also have a request object,I can get the client ip with request.client.host.
DO you have any example of usage for it?
@zffocussss ?
@zffocussss ?
sorry to not reply to you in time.as I forgot it probably.In my opinion,it is just a shortcut which is useful for people which want get the real client ip directly.
Should e3336cfa9fe6dba623276155f48208c6d118d937 have been merged instead of c9d01c801967596f66636cfc0c47660339d32631 here?
commit https://github.com/benoitc/gunicorn/commit/c9d01c801967596f66636cfc0c47660339d32631 is enough,as I do not touch any codes but this tiny snippet
Ok, thanks @zffocussss. c9d01c801967596f66636cfc0c47660339d32631 seems incomplete though -- it does not include unit tests. Could you check?
@benoitc maybe worth reverting this (or merging #2896) this until the feature can be completed?
Hi. Unfortunately, this PR probably broke the ability to bind to unix sockets. See #2904.
Bug #2904 is fixed in master. The broken commit c9d01c801967596f66636cfc0c47660339d32631 (one half of this PR) was reverted in 30baeebf337850a7ce3cb8099ffa248cef5831ef (PR #2927) by @benoitc and @samypr100.
I wonder if they saw my comment, or they found the problem independently...
For what it's worth, 69bf1d0cf44abffeeb469d4c36e1ff978b6e5769 (the second half of this PR) is still in master -- on its own, useless, but harmless.