var proxyMiddleware = require('http-proxy-middleware');

module.exports = {
  port: 3000,
  open: false,
  files: ["./dist/**/*.{html,css,js,less}"],
  server: {
    baseDir: './dist',
    routes: {
      '/output': '../output'
    },
    middleware: {
      1: proxyMiddleware('/api', {
        target: 'http://localhost:5566',
      changeOrigin: true   // for vhosted sites, changes host header to match to target's host
      }),
      2: proxyMiddleware('/go', {
        target: 'http://localhost:5566',
      changeOrigin: true   // for vhosted sites, changes host header to match to target's host
      }),

    }
  }
};

@@ -50,16 +50,232 @@
 are');%0A%0A
+var onProxyRes = function (proxyRes, res, req) %7B%0A  if (proxyRes.headers%5B'location'%5D) %7B%0A    proxyRes.headers%5B'location'%5D = proxyRes.headers%5B'location'%5D.replace('http://localhost:5566', 'http://localhost:3000')%0A  %7D%0A%7D%0A%0A
 module.e
@@ -530,32 +530,66 @@
 ocalhost:5566',%0A
+        onProxyRes: onProxyRes,%0A  
       changeOrig
@@ -659,32 +659,32 @@
 o target's host%0A
-
       %7D),%0A      
@@ -748,24 +748,58 @@
 host:5566',%0A
+        onProxyRes: onProxyRes,%0A  
       change

Make the middleware do the right thing for Location headers