Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
akupiec
GitHub Repository: akupiec/mad-proxy
Path: blob/master/src/middlewares/utils/proxyServer.js
115 views
1
const httpProxy = require('http-proxy');
2
const config = require('../../config/config');
3
4
const apiProxy = httpProxy.createProxyServer({
5
secure: config.proxy.secure,
6
changeOrigin: config.proxy.changeOrigin,
7
});
8
9
apiProxy.on('proxyReq', function (proxyReq, req) {
10
if (req.body && req.body instanceof Buffer) {
11
proxyReq.write(req.body.toString());
12
}
13
});
14
15
module.exports = apiProxy;
16
17