WEB-506 feat: add Remittance Module with 7-step payout wizard (#3200)
WEB-506 fix: address CodeRabbit review (security, validation) WEB-506 fix: make API gateway header name configurable (MIFOS_REMITTANCE_API_HEADER) WEB-506 fix: remove duplicate translation keys (Personal Information, Transaction Details)
This commit is contained in:
@@ -72,5 +72,38 @@ module.exports = [
|
||||
res.end('Proxy error: ' + (err && err.message ? err.message : 'Unknown error'));
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
context: ['/remittance-api'],
|
||||
target: 'http://54.225.231.146:8080',
|
||||
pathRewrite: { '^/remittance-api': '/1.0/remittance' },
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
logLevel: 'debug',
|
||||
onProxyReq: function (proxyReq, req, res) {
|
||||
// Inject API key server-side (same as nginx proxy_set_header in production)
|
||||
const apiKey = process.env.MIFOS_REMITTANCE_API_KEY || '';
|
||||
const apiHeader = process.env.MIFOS_REMITTANCE_API_HEADER || 'X-Gravitee-Api-Key';
|
||||
if (apiKey) {
|
||||
proxyReq.setHeader(apiHeader, apiKey);
|
||||
}
|
||||
const rewrittenPath = (req.url || '').replace(/^\/remittance-api/, '/1.0/remittance');
|
||||
console.log('[Proxy] Proxying:', req.method, req.url, '->', this.target + rewrittenPath);
|
||||
},
|
||||
onError: function (err, req, res) {
|
||||
console.error(
|
||||
'[Proxy] Error while proxying request:',
|
||||
req && req.method,
|
||||
req && req.url,
|
||||
'->',
|
||||
this.target,
|
||||
'-',
|
||||
err && err.message
|
||||
);
|
||||
if (res && !res.headersSent) {
|
||||
res.writeHead(502, { 'Content-Type': 'text/plain' });
|
||||
res.end('Proxy error: ' + (err && err.message ? err.message : 'Unknown error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user