简体   繁体   中英

How to get client_addr in Falcon Request object ?

There is remote_addr and access_routes in falcon Request object, but what is needed is client_addr of the request what is there in Pyramid I am not getting it how this can be done. without checking headers and all info.

I figured this out, to get exact client_address, we should first check HTTP_X_FORWARDED_FOR header and if after splitting by comma ie HTTP_X_FORWARDED_FOR.split(",")[0] is present than that is the client address otherwise request.remote_addr is the client address. This is needed especially in the case of Load balancer in front of your service and this is how Pyramid calculated client_addr .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM