简体   繁体   English

在天蓝色容器中的docker中获取客户端IP

[英]Obtain client IP in docker in azure container

Is there anyone who can help me to obtain user client IP from docker container that runs on Azure container instance ?有没有人可以帮助我从 Azure 容器实例上运行的 docker 容器中获取用户客户端 IP?

My code gets only local IP of something , i guess it is revers proxy.我的代码只获取某些东西的本地 IP,我猜它是反向代理。 So ip is 10.240.255.106;所以ip是10.240.255.106; Is headers I also have host IP (Public container IP) but nothing more.是标头我也有主机 IP(公共容器 IP)但仅此而已。 Headers标题

{"Cache-Control":["max-age=0"],"Connection":["keep-alive"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng, / ;q=0.8"],"Accept-Encoding":["gzip, deflate"],"Accept-Language":["en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7"],"Host":["23.99.249.54"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"],"Upgrade-Insecure-Requests":["1"],"DNT":["1"]} {"Cache-Control":["max-age=0"],"Connection":["keep-alive"],"Accept":["text/html,application/xhtml+xml,application/xml;q = 0.9,图像/ WEBP,图像/ APNG,/ q = 0.8 “],”接受编码“:[” gzip的,放气“],”接受-语言“:[” EN-US,连接; q = 0.9 ,ru-RU;q=0.8,ru;q=0.7"],"Host":["23.99.249.54"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit /537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"],"Upgrade-Insecure-Requests":["1"],"DNT":["1"]}

Is there a way to get real client IP?有没有办法获得真正的客户端IP?

No, ACI doesn't preserve the client IP.不,ACI 不保留客户端 IP。 You can create a feature request in the user voice.您可以在用户语音中创建功能请求。 https://feedback.azure.com/forums/602224-azure-container-instances?filter=top&page=1 https://feedback.azure.com/forums/602224-azure-container-instances?filter=top&page=1

要在控制器操作中的 asp.net core 中获取客户端 IP:

var ip = Request.HttpContext.Connection.RemoteIpAddress;

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

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