NGINX is a very popular reverse-proxy server for the Unix and Linux family of operating systems. Like IIS, it offers interesting features that are not provided out of the box by the ASP.NET Core hosts, such as caching requests, serving files straight from the filesystem, SSL termination, and others. You can configure it to forward requests to an ASP.NET Core application that is running standalone. This application needs to be modified to acknowledge forwarded headers as in the following:
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders =
ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto |
ForwardedHeaders.XForwardedHost
});
What this code does is extract information from the headers, X-Forwarded-For (requesting the client IP and possibly the port), X-Forwarded-Proto (the requesting protocol), and X-Forwarded-Host (the requesting host), and sets it in the appropriate properties...