Spring boot 网页包开发服务器代理有错误:HPE\u无效\u块大小
我在我的项目中使用webpack dev server。 项目使用SpringBoot+Tiles+Vue+webpack 环境:Spring boot 网页包开发服务器代理有错误:HPE\u无效\u块大小,spring-boot,webpack,proxy,webpack-dev-server,Spring Boot,Webpack,Proxy,Webpack Dev Server,我在我的项目中使用webpack dev server。 项目使用SpringBoot+Tiles+Vue+webpack 环境: OS: Mac OS Node Version: 9.4.0 NPM Version: 5.6.0 Webpack Version: 4.25.1 webpack-dev-server Version: 3.1.10 在本地环境中,FE端口使用8080,Web包开发服务器端口使用9090。 在/front/static dev/build/中创建按webpack打
OS: Mac OS
Node Version: 9.4.0
NPM Version: 5.6.0
Webpack Version: 4.25.1
webpack-dev-server Version: 3.1.10
在本地环境中,FE端口使用8080,Web包开发服务器端口使用9090。
在/front/static dev/build/中创建按webpack打包的文件。
因此,我使用如下代理选项
devServer: {
publicPath: 'http://localhost:9090/front/static-dev/build/',
port: 9090,
proxy: {
'/**': {
target: 'http://localhost:8080',
secure: false,
changeOrigin: true
}
},
open: true
}
[HPM] Error occurred while trying to proxy
request /api/v1/users/name from localhost:9090 to
http://localhost:8080 (HPE_INVALID_CHUNK_SIZE)
(https://nodejs.org/api/errors.html#errors_common_system_errors)
http://localhost:9090/api/v1/users/name net::ERR_CONTENT_DECODING_FAILED 502 (Bad Gateway)
启动WebpackDev服务器后,静态资源(JSP、捆绑的js文件、CSS文件或图像等)将正常加载。然而,每当我请求一些api时,WebpackDev服务器都会发生相同的错误。错误日志如下所示
devServer: {
publicPath: 'http://localhost:9090/front/static-dev/build/',
port: 9090,
proxy: {
'/**': {
target: 'http://localhost:8080',
secure: false,
changeOrigin: true
}
},
open: true
}
[HPM] Error occurred while trying to proxy
request /api/v1/users/name from localhost:9090 to
http://localhost:8080 (HPE_INVALID_CHUNK_SIZE)
(https://nodejs.org/api/errors.html#errors_common_system_errors)
http://localhost:9090/api/v1/users/name net::ERR_CONTENT_DECODING_FAILED 502 (Bad Gateway)
在请求了一些API之后,我检查了Eclipse上的日志,通常都会发出API请求。在Chrome Consloe日志中,如下所示
devServer: {
publicPath: 'http://localhost:9090/front/static-dev/build/',
port: 9090,
proxy: {
'/**': {
target: 'http://localhost:8080',
secure: false,
changeOrigin: true
}
},
open: true
}
[HPM] Error occurred while trying to proxy
request /api/v1/users/name from localhost:9090 to
http://localhost:8080 (HPE_INVALID_CHUNK_SIZE)
(https://nodejs.org/api/errors.html#errors_common_system_errors)
http://localhost:9090/api/v1/users/name net::ERR_CONTENT_DECODING_FAILED 502 (Bad Gateway)
我认为问题的部分原因在于此。
用谷歌的网页搜索HPE\u无效块大小,我找不到任何信息
我怎样才能解决这个问题
谢谢。我使用连接选项解决此问题
proxy: {
'/**': {
target: 'http://localhost:8080/',
secure: false,
changeOrigin: true,
headers: {
Connection: 'keep-alive'
}
}
此错误可能是由于发送到代理的标头错误造成的。如果出现任何进一步的问题,您可以尝试
传输编码:分块
或设置内容长度
http头。你可以看到这个答案