简体   繁体   中英

Forwarding tcp request to remote api in Nodejs, Express

i am using nodejs and express to build a restful webservice with no DB behind, but communicate with diffrent remote restful webservices, and i encountered the following problem,

My server located on US, but i have users from all around the world,

One of my remotes restful services that i am working with, does not support geo querying (not even by ip), and he asked me to do forwarding tcp request to his api, so he'll recogize users geo on his side.

I am using hyper-request as my module for sending request, but relavnet solution with any other module will be helpful. Thanks.

If you want your other remote services to lookup the Geographic data of the IP you will need to proxy the requests with an extra X-Forwarded-For HTTP Header, and they will have to whitelist your server's IP as a trustworthy proxy.

But you cannot spoof your source IP so that it matches your original user's.

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