Skip to content

Instantly share code, notes, and snippets.

@sunb0002
Created April 23, 2020 07:39
Show Gist options
  • Save sunb0002/8cedc834d440f1e52afedeaa639fec35 to your computer and use it in GitHub Desktop.
Save sunb0002/8cedc834d440f1e52afedeaa639fec35 to your computer and use it in GitHub Desktop.
'use strict';
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const app = express();
app.use('/aaa/bbb/ccc/', createProxyMiddleware({
target: 'http://10.1.2.3:1234',
changeOrigin: true,
pathRewrite: {
'^/aaa/bbb/ccc/': '/'
},
}));
app.listen(8451, () => {
console.log("Node.js proxy is running...")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment