Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
falcon Request 对象中有remote_addr和access_routes,但需要的是请求的client_addr Pyramid 中有什么我不知道如何做到这一点。不检查标题和所有信息。
我想通了,要获得准确的 client_address,我们应该首先检查HTTP_X_FORWARDED_FOR标头,如果在用逗号拆分后,即 HTTP_X_FORWARDED_FOR.split(",")[0] 存在,则不是客户端地址,否则request.remote_addr是客户端地址. 这是需要的,尤其是在您的服务前面的负载均衡器的情况下,这就是Pyramid计算client_addr的方式。