Skip to content

Proxy settings do not accept an array but array passes validations and fails silently #3524

@aldencolerain

Description

@aldencolerain

Version

3.4.1

Steps to reproduce

in vue config set proxy config to:

devServer: {
  overlay: {
    warnings: true,
    errors: true
  },
  host: '0.0.0.0',
  disableHostCheck: true,
  index: '',
  proxy:[{
    context: ['/**', '!/app.js', '!/sockjs-node/**'],
    target: 'http://localhost:8000'
  }]
}

What is expected?

The http-proxy-middleware package accepts an array as a config option (https://github.com/chimurai/http-proxy-middleware#context-matching) but this is not supported by vue-cli. Vue cli should warn the user that the array syntax is unsupported.

What is actually happening?

No error is raised because in the prepareProxy function in prepareProxy.js typeof proxy !== 'object' is used to check that the proxy config is an object, but an array passes this test. The typeof an Array is 'object'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions