Skip to content

devServer.proxy support array config #2285

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
Astray-git opened this issue Aug 20, 2018 · 2 comments
Open

devServer.proxy support array config #2285

Astray-git opened this issue Aug 20, 2018 · 2 comments

Comments

@Astray-git
Copy link

Astray-git commented Aug 20, 2018

What problem does this feature solve?

Passing an Array to devServer.proxy is not supported.
It can be used to proxy multiple, specific paths to the same target.

https://webpack.js.org/configuration/dev-server/#devserver-proxy

What does the proposed API look like?

module.exports = {
  //...
  devServer: {
    proxy: [{
      context: ['/auth', '/api'],
      target: 'http://localhost:3000',
    }]
  }
};
@Astray-git Astray-git changed the title devServer.proxy support array config devServer.proxy support array config Aug 20, 2018
@alexdilley
Copy link

You can get equivalent functionality via:

{
  proxy: {
    ...['/auth', '/api'].reduce(
      (acc, ctx) => ({
        ...acc,
        [ctx]: { target: 'http://localhost:3000' },
      }),
      {}
    ),
  },
},

@lbineau
Copy link

lbineau commented Apr 8, 2021

Any update on that issue?

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

No branches or pull requests

4 participants