question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Docs] More detail for `Microsoft.AspNetCore.Http.ConnectionInfo.RemoteIpAddress`

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

One uses HttpContext.Connection.RemoteIpAddress to get a client’s IP address.

Microsoft.AspNetCore.Http.ConnectionInfo.RemoteIpAddress is marked as nullable.

The docs linked above just say “Can be null” - under what conditions can it be null?

Describe the solution you’d like

The docs for Microsoft.AspNetCore.Http.ConnectionInfo.RemoteIpAddress are unclear. Please add more detail.

Additional context

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Tratchercommented, Feb 14, 2022
  • Kestrel is behind a reverse proxy server, and UseForwardedHeaders is not configured

When Kestrel is behind a reverse proxy then RemoteIpAddress will report the address of the proxy rather than null. I think the SO issue with IIS returning was null for a preview where this hadn’t been fully implemented yet.

1reaction
davidfowlcommented, Feb 14, 2022

If the connection isn’t a tcp connection. It could be a Unix domain socket or a transport that isn’t up based

Read more comments on GitHub >

github_iconTop Results From Across the Web

ConnectionInfo.RemoteIpAddress Property
Gets or sets the IP address of the remote target. Can be null.
Read more >
IHttpConnectionFeature.RemoteIpAddress Property
Gets or sets the IPAddress of the client making the request. Note this may be for a proxy rather than the end user....
Read more >
ConnectionInfo Class (Microsoft.AspNetCore.Http)
Represents the underlying connection for a request. ... In this article ... Http. Assembly: Microsoft.AspNetCore.Http.Abstractions.dll. Package: Microsoft.
Read more >
HttpConnectionFeature.RemoteIpAddress Property
Gets or sets the IPAddress of the client making the request. Note this may be for a proxy rather than the end user....
Read more >
Configure ASP.NET Core to work with proxy servers and ...
Learn about configuration for apps hosted behind proxy servers and load balancers, which often obscure important request information.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found