5
votes

Is there anyone who can help me to obtain user client IP from docker container that runs on Azure container instance ?

My code gets only local IP of something , i guess it is revers proxy. So ip is 10.240.255.106; Is headers I also have host IP (Public container IP) but nothing more. 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"]}

Is there a way to get real client IP?

2
I do not really know what do you mean the client IP?Charles Xu
Sorry. This is asp.net core Web API. I need to obtain user IPgrinay

2 Answers

4
votes

No, ACI doesn't preserve the client IP. You can create a feature request in the user voice. https://feedback.azure.com/forums/602224-azure-container-instances?filter=top&page=1

0
votes

To get the client IP in asp.net core inside the controller action:

var ip = Request.HttpContext.Connection.RemoteIpAddress;