fix: update CORS middleware to correctly match public API endpoints
Deploy Application / deploy (push) Successful in 46s Details

This commit is contained in:
faisolavolut 2025-11-26 13:27:33 +07:00
parent b8f05e501a
commit 21fa8cec4d
1 changed files with 3 additions and 3 deletions

View File

@ -27,9 +27,9 @@ const CORS_CACHE_TTL_MS =
app.use((req, res, next) => { app.use((req, res, next) => {
// Check if this is a public API endpoint that should allow any origin // Check if this is a public API endpoint that should allow any origin
const isPublicAPIEndpoint = const isPublicAPIEndpoint =
req.path.match(/^\/[^\/]+\/transfer-va\/(inquiry|payment)$/) || req.path.match(/^\/api\/[^\/]+\/transfer-va\/(inquiry|payment)$/) ||
req.path.match(/^\/[^\/]+\/access-token\/b2b$/) || req.path.match(/^\/api\/[^\/]+\/access-token\/b2b$/) ||
req.path.match(/^\/[^\/]+\/utilities\/signature-service$/); req.path.match(/^\/api\/[^\/]+\/utilities\/signature-service$/);
if (isPublicAPIEndpoint) { if (isPublicAPIEndpoint) {
// Allow any origin for public API endpoints // Allow any origin for public API endpoints
const publicCorsOptions = { const publicCorsOptions = {