Initial commit: added frontend and backend
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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');
|
||||
}
|
||||
})
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user