Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack-dev-server proxy has an error [HPE_INVALID_CHUNK_SIZE] #1579

Closed
Younghun-Jung opened this issue Nov 27, 2018 · 3 comments
Closed

webpack-dev-server proxy has an error [HPE_INVALID_CHUNK_SIZE] #1579

Younghun-Jung opened this issue Nov 27, 2018 · 3 comments

Comments

@Younghun-Jung
Copy link

Younghun-Jung commented Nov 27, 2018

  • Operating System: macOS Mojave
  • Node Version: 9.4.0
  • NPM Version: 5.6.0
  • webpack Version: 4.25.1
  • webpack-dev-server Version: 3.1.10
  • [x ] This is a bug
  • [x ] This is a modification request

Description

I use webpack-dev-server on my project. Project uses Spring boot + Tiles + Vue + webpack.
In local environment, Front-end port uses 8080 and webpack-dev-server port is 9090. Bundled files by webpack are created in /front/static-dev/build/. So, I use proxy options like below.

  // webpack.config.js
devServer: {
    publicPath: 'http://localhost:9090/front/static-dev/build/',
    port: 9090,
    proxy: {
        '/**': {
            target: 'http://localhost:8080',
            secure: false,
            changeOrigin: true
        }
    },
    open: true
}

After starting webpack-dev-server, static resources like (JSP, bundled js files, CSS files or image, ...) are loaded normally. However, whenever I request some api, webpack-dev-server occured same error. Error logs in terminal are like below.

[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)

After request some API, I checked logs on Eclipse and Api requests are normally being made. In Chrome Consloe log like below.

http://localhost:9090/api/v1/users/name net::ERR_CONTENT_DECODING_FAILED 502 (Bad Gateway)

I think the problems are in response part. Searching HPE_INVALID_CHUNK_SIZE with Webpack in google, I can find no information.

How can I solve this problem.

Thanks.

Expected Behavior

Whenever request Backend API, webpack dev server proxy request.

Actual Behavior

Error occurred while trying to proxy reques. Error info is HPE_INVALID_CHUNK_SIZE)

@alexander-akait
Copy link
Member

Problem on your side, 502 (Bad Gateway) says what proxy server doesn't response

@Younghun-Jung
Copy link
Author

I solved this problem.
I did not configure connection options like below.

devServer: {
    publicPath: 'http://localhost:9090/front/static-dev/build/',
    port: 9090,
    proxy: {
        '/**': {
            target: 'http://localhost:8080',
            secure: false,
            changeOrigin: true,
            headers: {
                   Connection: 'keep-alive'
            }
    },
    open: true
}

@alexander-akait
Copy link
Member

@Younghun-Jung 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants