0

where am I supposed to connect when I proxy to an third domain like that ?

module.exports = {

  ...
  devServer: {
    proxy: {
      "/": {
        target: "http://www.example.org",
      },
      changeOrigin: true
    }
  }
  ...
}

shouldn't localhost:8080 show http://www.example.org content ?

because I get a 404 page... (the same is true with other sites, I get not-founds, or even apache install pages!)

Daniele
  • 829
  • 1
  • 13
  • 23
  • I tried to figure it out, but haven't been able to yet. The following two links are documentation that should help solve the issue. https://webpack.js.org/configuration/dev-server/#devserver-proxy and https://github.com/chimurai/http-proxy-middleware#options – thomasmeadows Aug 13 '17 at 14:49
  • I think it could be a misconfiguration due to Mamp... – Daniele Aug 14 '17 at 06:38
  • just tested on another computer and as suspected should be linked to some misconfiguration on my laptop. besides, don't really know where to start to figure it out, uninstalling MAMP didn't help... – Daniele Aug 16 '17 at 11:23
  • I know this post is old, but have you found a solution? – Mrtnchps Aug 19 '19 at 21:02
  • the solution in my own answer worked well for me – Daniele Sep 11 '19 at 15:22

1 Answers1

2

this is the right configuration

module.exports = {
...
devServer: {
  proxy: {
    "/": {
      target: "http://www.example.org",
      changeOrigin: true
    },
  }
}
...
}
Daniele
  • 829
  • 1
  • 13
  • 23