search

Home  >  Q&A  >  body text

javascript - How to use http-proxy-middleware to proxy local requests

Now I have such a requirement. I hope that all requests for '/test/' in the express project will be requested for '/' at the end. How can such a requirement pass through the http-proxy-middleware middleware? To realize it? Or is there any other way to achieve it?

PHP中文网PHP中文网2884 days ago614

reply all(1)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 13:28:38

    If used vue-cli的话在config/index.jsConfigure in

    proxyTable: {
        '/api': {
            target: 'http://127.0.0.1:8888',
            changeOrigin: true,
            pathRewrite: {
                '^/api': '/'
            }
        }
    },

    reply
    0
  • Cancelreply