Skip to content

fix(proxy): add connection keep-live option proxy #4791

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

fouad-j
Copy link

@fouad-j fouad-j commented Nov 3, 2019

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:

I faced a proxy issue for POST call with body contains more than 40.000 characters.

this the error I got:

[1] Proxy error: Could not proxy request /rest/v1/hello from localhost:8080 to http://localhost:4300/.
[1] See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).
[1] [HPM] Error occurred while trying to proxy request /rest/v1/hello from localhost:8080 to http://localhost:4300/ (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)

Steps to reproduce

vue.config.js

module.exports = {
  publicPath: '.',
  devServer: {
    proxy: {
      '(/rest/.*|/v1/.*)': {
        target: 'http://localhost:4300',
        secure: false,
        logLevel: 'debug'
      }
    }
  }
};

server express

const express = require('express');
const router = express.Router();
const app = express();

router
  .get('/rest/v1/hello', (req, res) => res.send({}));

app
  .use(router)
  .listen(4300, () => console.log('App listening at http://localhost:%s', 4300));

call from my vue.js application

const body = {};/*more than 40.000 characters*/
axios
  .post('/rest/v1/hello', body)
  .then(response => response.data)
  .then(test => commit({type: 'test', test}));

after debug, I remarked that the proxy request was "Connection: close"

So I change it to 'Connection: keep-alive' it fixed this issue

I think this option should be add to proxy default value

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

Successfully merging this pull request may close these issues.

2 participants