Files
limelite_faceanalyzer/frontend/src/setupProxy.js
T

34 lines
1004 B
JavaScript

const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/wacto-api',
createProxyMiddleware({
target: 'https://api.wacto.app',
changeOrigin: true,
pathRewrite: {
'^/wacto-api': '', // remove /wacto-api from the request URL
},
onProxyReq: function(proxyReq, req, res) {
// Bypass Origin headers so Wacto API thinks the request is local to itself
proxyReq.setHeader('Origin', 'https://api.wacto.app');
}
})
);
app.use(
'/perfectcorp-api',
createProxyMiddleware({
target: 'https://yce-api-01.perfectcorp.com',
changeOrigin: true,
pathRewrite: {
'^/perfectcorp-api': '', // remove prefix from proxied request
},
onProxyReq: function(proxyReq, req, res) {
// Spoof the origin similarly for PerfectCorp's S2S security wall
proxyReq.setHeader('Origin', 'https://yce-api-01.perfectcorp.com');
}
})
);
};