简体   繁体   中英

webpack devServer and proxy shows a 404 page

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!)

this is the right configuration

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM