开发者

What HTTP header should a REST client pass for the IP Address of a web client?

开发者 https://www.devze.com 2023-04-09 15:28 出处:网络
I am developing a web service that another group is developing a web front end against.My web service needs to do some IP Address logging of the web client, so I need the web front end to pass me the

I am developing a web service that another group is developing a web front end against. My web service needs to do some IP Address logging of the web client, so I need the web front end to pass me the IP Address of the actual user in a HTTP header. My original thought was to use X-Forwarded-For, but that did not feel completely correct, is there a better header for this?

Note: The REST client is trusted and a开发者_StackOverflow中文版uthenticated, so I am not worry about a malicious client spoofing the source address.


I think X-Forwarded-For sounds like the perfect header for your use-case. It's supported by many proxy servers and although it's not ratified in an RFC, the problem it solves is so small that there's little chance of interoperability problems. Why don't you want to use it?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号