umijs服务器代理配置,多个代理
同时代理api和资源:
//服务器代理 proxy: { '/api': { target: 'http://xxx', changeOrigin: true, pathRewrite: { '^/api/': '/api/', }, }, //media资源代理 '/media': { target: 'http://xxx', changeOrigin: true, pathRewrite: { '^/media': '/media', }, }, },
即可实现访问http://localhost/api/*和http://localhost/media/*时跳转到指定到http://xxx/api/*和http://xxx/media/*
博客园作者:herry菌朋友,看到这里,关注作者的公众号吧,不漏掉更新哦
![]()