With the HttpRequestData in Microsoft.Azure.Functions.Worker.Http, how does one retrieve the Remote IP address?

Viewed 209

With an Azure Function App written in .NET 3.x, an HTTP Trigger binding gives you access to an HttpRequest object. e.g.

public async Task<IActionResult> Run(
  [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,

From that you could inspect '{req.HttpContext.Connection.RemoteIpAddress}' to log out where the request is coming from.

With the .NET 5 isolated worker model, the HTTP Trigger binding gives you an HTTPRequestData object. e.g.

public static HttpResponseData Run(
  [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req, FunctionContext executionContext)

Is this Remote IP information available still? Is it on the FunctionContext or Headers property?

0 Answers
Related