I have two docker images one for nginx that is used to receive a request from the clients, the request contains the client's IP address, User-Agent. The other image is an asp.net application that is used to receive the request send from the nginx with the client information. My problem is that the request received contains the nginx information not the client information. The configuration of the nginx docker image is shown bellow.
<app-mycomponent></app-mycomponent>
答案 0 :(得分:2)
您的配置正确无误。我认为你的asp.net核心应用程序中的问题。请检查以下内容:
接收IP地址:
var ipAddress = context.Connection.RemoteIpAddress;
接收用户代理:
var userAgent = context.Request.Headers["User-Agent"];
答案 1 :(得分:1)
这是我曾经通过nginx成功将请求传递给asp.net核心应用程序的miminal配置:
location / {
proxy_pass http://myhost.com;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
与http和websockets配合得很好。我已经将它用作软件负载均衡器仿真。