【发布时间】:2021-08-18 21:47:39
【问题描述】:
这是我在 docker 机器内的 nginx.conf 文件的反向代理部分:
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 标头字段传递给嵌套应用程序:
async function bootstrap() {
const app = await NestFactory.create(AppModule, { cors: true });
app.setGlobalPrefix('api');
await app.listen(7000);
}
bootstrap();
【问题讨论】:
标签: nginx nestjs reverse-proxy