运行 Angular-CLI 时设置节点选项
Set Node options when running with Angular-CLI
应用程序 return 400 因为它有 3 个 cookie,每个大约 4k bytes
。当 运行 具有 angular cli
的应用程序时,我正在尝试设置 max-http-header-size
属性。 (ng serve
)
应用程序在 运行 投入生产时按预期工作。
技术:
angular CLI: 8.1.3
asp.net core 2.1.3
试过 运行 node --max-http-header-size=14000
但还是不行。
新模板 (ASP.NET Core 2.2) 直接传递给 nodejs,因此您设置的所有内容都与 w/o ASP.NET Core 相同。
您可以通过查看 Startup.cs
来了解您使用的是新模板还是旧模板。如果有 app.UseSpa(spa => { ... });
行,则表示您正在使用新的包和 SPA 方法,其中 ASP.NET Core 只是将所有内容通过管道传输到以应用程序启动的 nodejs 服务器。
查看 package.json
文件中的 scripts
部分,应该有一个开始部分,其中包含启动应用程序时获得 运行 的命令(和参数),一些东西喜欢
"scripts": {
"ng": "ng",
"start": "ng serve --extract-css",
"build": "ng build --extract-css",
"build:ssr": "npm run build -- --app=ssr --output-hashing=media",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
解决方案是在调用 ng serve 函数之前设置最大 header 大小的值:node --max-http-header-size=100000 ./node_modules/@angular/cli/bin/ng serve
如果您使用的是 ASP.NET 核心,可以在 package.json 中添加:
"scripts": {
"ng": "ng",
"start": "node --max-http-header-size=100000 ./node_modules/@angular/cli/bin/ng serve",
"build": "ng build"
}
应用程序 return 400 因为它有 3 个 cookie,每个大约 4k bytes
。当 运行 具有 angular cli
的应用程序时,我正在尝试设置 max-http-header-size
属性。 (ng serve
)
应用程序在 运行 投入生产时按预期工作。
技术:
angular CLI: 8.1.3
asp.net core 2.1.3
试过 运行 node --max-http-header-size=14000
但还是不行。
新模板 (ASP.NET Core 2.2) 直接传递给 nodejs,因此您设置的所有内容都与 w/o ASP.NET Core 相同。
您可以通过查看 Startup.cs
来了解您使用的是新模板还是旧模板。如果有 app.UseSpa(spa => { ... });
行,则表示您正在使用新的包和 SPA 方法,其中 ASP.NET Core 只是将所有内容通过管道传输到以应用程序启动的 nodejs 服务器。
查看 package.json
文件中的 scripts
部分,应该有一个开始部分,其中包含启动应用程序时获得 运行 的命令(和参数),一些东西喜欢
"scripts": {
"ng": "ng",
"start": "ng serve --extract-css",
"build": "ng build --extract-css",
"build:ssr": "npm run build -- --app=ssr --output-hashing=media",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
解决方案是在调用 ng serve 函数之前设置最大 header 大小的值:node --max-http-header-size=100000 ./node_modules/@angular/cli/bin/ng serve
如果您使用的是 ASP.NET 核心,可以在 package.json 中添加:
"scripts": {
"ng": "ng",
"start": "node --max-http-header-size=100000 ./node_modules/@angular/cli/bin/ng serve",
"build": "ng build"
}