javascript - How to use http-proxy-middleware to proxy local requests
PHP中文网
PHP中文网 2017-05-16 13:26:38
0
1
551

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中文网

认证0级讲师

reply all(1)
習慣沉默

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

proxyTable: {
    '/api': {
        target: 'http://127.0.0.1:8888',
        changeOrigin: true,
        pathRewrite: {
            '^/api': '/'
        }
    }
},
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template