Nginx 反向代理不会在自定义位置传递 header 值

Nginx reverse proxy doesn't pass header values in custom location

这是 docker 机器中我的 nginx.conf 文件的 reverse-proxy 部分:

location / {
    try_files $uri @customer_pwa;
}

location /api {
    try_files $uri @rest_api;
}

location @rest_api {
    proxy_http_version 1.1;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header HOST $host;
    proxy_set_header X-NginX-Proxy true;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_cache_bypass $http_upgrade;
    proxy_pass http://api:7000;
}

但是反向代理没有将我的 access_token header 字段传递给嵌套应用程序:

async function bootstrap() {
  const app = await NestFactory.create(AppModule, { cors: true });
  app.setGlobalPrefix('api');
  await app.listen(7000);
}
bootstrap();

underscores_in_headers on;

将允许带下划线 headers!