fix: update CORS middleware to correctly match public API endpoints
Deploy Application / deploy (push) Successful in 46s
Details
Deploy Application / deploy (push) Successful in 46s
Details
This commit is contained in:
parent
b8f05e501a
commit
21fa8cec4d
|
|
@ -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 = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue