Nginx 无意中更改了上游服务器提供的文件头

Nginx 无意中更改了上游服务器提供的文件头

我有一个设置,其中 Nginx 1.15 作为 asp.net core 应用程序的反向代理运行。我已向 asp.net core 应用程序提供的文件添加了一些 Content-Encoding 标头。当我直接向 asp.net core 应用程序发送请求时,我可以看到它存在。但是当我向 Nginx 发送请求时,标头(Content-Encoding)不存在!问题是什么?

这是 nginx 配置:

  ##FRONTIER
server {
 listen 80;

 server_name 0.0.0.0;

 location / {
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header Host $host;

   proxy_pass http://frontier_server;

   # enable WebSockets
   proxy_http_version 1.1;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "keep-alive";
 }

}

curl 到 nginx:

TP/1.1 200 OK
Date: Mon, 15 Apr 2019 08:19:15 GMT
Server: nginx/1.15.2
Content-Type: text/plain
Content-Length: 96381
Last-Modified: Sun, 14 Apr 2019 13:23:12 GMT
Accept-Ranges: bytes
ETag: "1d4f2c53577587d"
Age: 1

直接 curl 到 asp.net core 应用程序:

HTTP/1.1 200 OK
Date: Mon, 15 Apr 2019 08:20:48 GMT
Content-Type: application/x-gzip
Server: Kestrel
Content-Length: 96381
Content-Encoding: gzip
Last-Modified: Sun, 14 Apr 2019 13:23:12 GMT
Accept-Ranges: bytes
ETag: "1d4f2c53577587d"

nginx 和应用程序都在 docker 容器内运行。

nginx docker-compose:

version: '3'
services:
  nginx:
    image: "mynginx:2"
    container_name: nginx
    ports:
    - 3000:3000
    - 80:80
    - 4000:4000
    - 4001:4001
    - 443:443
    volumes:
    - /var/dana/nginx/nginx.conf:/etc/nginx/nginx.conf
    - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

networks: 
  default:
    external:
      name: dana

应用程序docker-compose:

version: '3'
services:
  website:
    build: .
    container_name: website
    ports:
    - 5000:5000
    volumes:
    - /var/dana/website/appsettings.json:/app/appsettings.json
    - /etc/localtime:/etc/localtime
    - /var/dana/website/wwwroot/.well-known/:/app/wwwroot/.well-known/
    restart: unless-stopped


networks: 
  default:
    external:
      name: dana

谢谢

相关内容