search

Home  >  Q&A  >  body text

javascript - webpack dev server reports error 404, how to solve it?

Webpack dev server always reports error 404 when configuring reverse proxy. How to solve it?

Error log: GET http://localhost:8080/mzabris... 404 (Not Found)

Configuration file:

devServer: {
      inline: true,
      noInfo: true,
      port: 8080,
      proxy: {
        '/mzabriskie': {
          target: 'https://github.com',
          changeOrigin: true
        }
      }
  },

Interface code:

    this.$http.get('/mzabriskie/axios').then((response) => {
      console.log(response)
    }).catch((error) => {
      console.log(error)
    })
漂亮男人漂亮男人2775 days ago532

reply all(3)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-18 11:03:53

    There seems to be nothing wrong with the configuration, mainly because I seem to have written the wrong file....

    reply
    0
  • 怪我咯

    怪我咯2017-05-18 11:03:53

    There is absolutely no problem with your code...Have you restarted webpack after modifying the configuration?

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-18 11:03:53

    Add a line

    proxy: {
            '/mzabriskie': {
              target: 'https://github.com',
              changeOrigin: true,
              '/mzabriskie': '/mzabriskie'
    
            }
          }

    Then restart webpack

    reply
    0
  • Cancelreply