简体   繁体   English

代表客户端而不是服务器在服务器中发出请求

[英]making request in server on behalf of client instead of server

I have the following scenario. 我有以下情况。 A person makes a request to my server, a controller handles this request. 一个人向我的服务器发出请求,控制器处理该请求。 Inside this controller code I have a logic that makes another GET request to some endpoint. 在此控制器代码中,我有一个逻辑,该逻辑向某个端点发出另一个GET请求。 Is it possible to have/make the request to this GET endpoint on behalf of this person's IP address (use it as a proxy) instead of the server's IP address ?? 是否可以代表此人的IP地址(使用它作为代理)而不是服务器的IP地址向此GET端点发出请求?

If your server is making this request, server IP will be used, this is legit. 如果您的服务器发出此请求,则将使用服务器IP,这是合法的。 As for http, you can use x-forwarded-for header to point recipient that your server is used like proxy for client. 至于http,您可以使用x-forwarded-for标头指出收件人,您的服务器被用作客户端的代理。

Another solution is to force client to make this request via some sort of callbacks. 另一种解决方案是强制客户端通过某种回调来发出此请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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