fix marbas proxy

This commit is contained in:
2023-10-30 10:50:47 +01:00
parent 1f1821d607
commit 75f70cfd25
5 changed files with 29 additions and 20 deletions

View File

@@ -22,11 +22,11 @@ export default defineConfig(({ mode }) => {
usePolling: true
},
proxy: {
'/api/': {
target: env.API_URL,
'/marbas/': {
target: env.MARBAS_URL,
changeOrigin: true,
followRedirects: true,
rewrite: path => path.replace(/^\/api/, ''),
rewrite: path => path.replace(/^\/marbas/, ''),
selfHandleResponse: true,
configure: proxy => {
proxy.on('proxyRes', (proxyRes, req, res) => {
@@ -38,7 +38,7 @@ export default defineConfig(({ mode }) => {
const encoding = proxyRes.headers["content-encoding"];
const relace = (b: Buffer) => {
let remoteBody = b.toString();
const modifiedBody = remoteBody.replace(env.API_URL, '/api/');
const modifiedBody = remoteBody.replace(env.MARBAS_URL, '/marbas/');
res.write(modifiedBody);
res.end();