首页 > 解决方案 > Angular: Proxy server truncates XHR response

问题描述

In an angular 6 project the express proxy server suddenly started truncating responses to XHR at 8192 characters (behavior only applies to XHR re. The content of the endpoint doesn't matter, if the response is longer than 8192 characters it gets truncated. Trimming the content returned by the problematic endpoint to less than that, response is not truncated. If i modify another endpoint to return a a JSON string longer than 8192 chars, response is truncated. No problems when i load the project into a production environment, all endpoints work as expected regardless of length.

I have removed and reinstalled node_modules and updated the local ng-cli to 6.2.9 without solving the problem. Not sure what else to try to get this solved.

Problem seems similar to https://github.com/webpack/webpack-dev-server/issues/1574, except the truncation in consistent for the problematic response size.

node: 8.14.0

npm: 6.4.1

devDependencies:

"@angular-devkit/build-angular": "^0.8.9",
"@angular/cli": "^6.2.9",
"@angular/compiler-cli": "^6.1.10",
"@types/jasmine": "2.8.7",
"@types/node": "^6.14.2",
"codelyzer": "^4.5.0",
"jasmine-core": "^2.99.1",
"jasmine-spec-reporter": "~3.2.0",
"karma": "^3.1.3",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "0.2.0",
"karma-firefox-launcher": "^1.1.0",
"karma-ie-launcher": "1.0.0",
"karma-jasmine": "^1.1.2",
"karma-jasmine-html-reporter": "0.2.2",
"karma-remap-istanbul": "0.6.0",
"protractor": "^5.4.1",
"remap-istanbul": "0.9.5",
"ts-node": "~2.0.0",
"tslint": "^5.11.0",
"typescript": "^2.9.2",
"webpack": "^4.27.0"

Wasn't sure what, if any, other information to add. If there's something that would help you help me, let me know.

标签: expressangular-cli

解决方案


有同样的问题,通过将节点更新到最新的 lts (10.15.1) 来解决


推荐阅读