Angular 8 代理和 oauth2 400 错误请求

Angular 8 proxy and oauth2 400 bad request

将我的 angular-app 从 angular 7.2.11 升级到 angular 8.1.3 后。

Angular HttpClientModule 在使用代理时不发送我的 oauth2 安全请求。

Proxy-config:

{
  "/oauth/*": {
    "target": "http://localhost:8090",
    "secure": false,
    "logLevel": "debug"
  },
  "/api/**": {
    "target": "http://localhost:8090",
    "secure": true,
    "logLevel": "debug",
    "changeOrigin": true
  }
}

Oauth2-config(使用@auth0/angular-jwt 3.0.0)

HttpClientModule,
    JwtModule.forRoot({
      config: {
        tokenGetter: tokenGetter
      }
    }),

我找到了解决方案,我的 oauth2-token 似乎变得太大了,它在 angular 代理上达到了 http-header-limit。

我已经用下面的命令解决了:

`"scripts":{ "start": "node --max-http-header-size=100000 ./node_modules/@angular/cli/bin/ng serve --host=0.0.0.0 --proxyConfig=proxy.conf.json -o",

},`