webpack-dev-server: spdy break content when you use difference protocols for dev server and proxy
- Operating System: MacOS High Sierra v 10.13.6
- Node Version: 8.9.2
- NPM Version: 6.4.1
- webpack Version: 4.26.0
- webpack-dev-server Version: 3.1.10
- This is a bug
- This is a modification request
Code
// webpack.config.js
config.devServer = {
hot: true,
contentBase: resolve(__dirname, '/'),
disableHostCheck: true,
publicPath: '/',
headers: {
'Accept-Encoding': '',
},
historyApiFallback: true,
host: '0.0.0.0',
compress: true,
quiet: true,
proxy: {
'/api': {
target: 'https://XXXXX',
secure: false,
changeOrigin: true,
}
}
I added the Accept-Encoding header per this advice: https://github.com/webpack/webpack-dev-server/issues/354, but it does not solve the problem. I also tried changing the timeout settings without success
Expected Behavior
That when proxying a GET request to /api, the full JSON response will be received
Actual Behavior
Sometimes the request is properly fulfilled and sometimes the response is truncated. This only happens with > 3mb JSON response.
When disabling Chrome web security and making the request directly to the server (without the wds proxy), the request is always fulfilled properly.
For Bugs; How can we reproduce the behavior?
Make a GET request with a JSON response > 3mb through the wds proxy.
To test without the proxy, disable Chrome security and make the request directly to the server.
To disable web security, from terminal:
open /Applications/Google\ Chrome.app --args --user-data-dir="/var/tmp/Chrome dev session" --disable-web-security
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 6
- Comments: 47 (21 by maintainers)
i found our api response data (large json ) is truncated . the api server support http2 and it only reproduced in http2 . we can force proxy server use http1.1 always:
My Payload is 512KB and I have the same issue. JSON it gets corrupts in webpack-dev-server Version: 3.1.11 - 3.1.14. The only one is working fine is 3.1.10
for users who are not using nodejs 10 for some reasons it uses only spdy which in webpack-dev-server above 3.1.10 fails for some reasons for the guys here, it truncates response in some cases. there is no way for us to use latest versions of webpack-dev-server since we can’t manually select which protocol we want to use
webpack-dev-server detects node v10 and runs https server which works just fine, node < 10, runs spdy library which above version 3.4.7 fails for some users
@victors1681 please create minimum reproducible test repo, otherwise issue was closed and marked as spam
@eemeli we don’t touch anything with
3.1.9around proxyI also got this issue after upgrading from
3.1.10. Big JSON responses get either truncated or even corrupted.