question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't configure devServer proxy many entries

See original GitHub issue

Version

3.0.0-beta.6

Reproduction link

https://github.com/vuejs/vue-cli/blob/114e085b314a8135a6fcb752c9ab903abba68465/packages/%40vue/cli-service/lib/util/prepareProxy.js#L111

Steps to reproduce

Set up two proxies in devServer configuration

{
    '/api': {
      target: 'http://localhost:9488',
      pathRewrite: {'^/api/': '/api/'},
      xfwd: true
    },
    '/auth': {
      target: 'http://localhost:9485',
      pathRewrite: {'^/auth/': '/auth/'},
      xfwd: true
    }
  }

What is expected?

Both proxies should work.

What is actually happening?

It seems to configure the last entry only. In fact, it doesn’t seem that devServer supports an array of proxy definition , an associative object should be given.


Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
FFGFcommented, Nov 16, 2018

you can write as follow devServer: { proxy: { ‘/getAbc|/getSde|/getCde’: { target: ‘http://127.0.0.1:3000/avc/’, }, ‘/initQwer’: { target: ‘http://127.0.0.1:3000/def’, }, ‘/getCvf’: { target: ‘http://127.0.0.1:3000/efd/’ } } }

1reaction
tangdwcommented, Aug 10, 2018

@zimplexing 这里的 proxy 好像并不支持 webpack-dev-server 的 devServer.proxy写法 https://webpack.docschina.org/configuration/dev-server/#devserver-proxy

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure a webpack proxy for multiple URLs efficiently?
I'm using webpack dev server to build ...
Read more >
DevServer - webpack
Be aware that when exporting multiple configurations only the devServer options for the first configuration will be taken into account and used for...
Read more >
devServer proxy(in vue.config.js) not working - Get Help
I encountered this problem, too. devServer proxy not working What should i do? vue.config.js exists in root dir of vue project.
Read more >
webpack-dev-server
To the use inline mode specify --inline on the command line (you cannot specify it in the configuration). This adds the webpack-dev-server client...
Read more >
Development Server - SurviveJS
devServer.proxy - If you are using multiple servers, you have to proxy WDS to them. The proxy setting accepts an object of proxy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found