fix: simplify cache key handling in CORS middleware
Deploy Application / deploy (push) Successful in 37s
Details
Deploy Application / deploy (push) Successful in 37s
Details
This commit is contained in:
parent
a82c732811
commit
83ac69ac71
13
src/app.ts
13
src/app.ts
|
|
@ -56,16 +56,7 @@ app.use((req, res, next) => {
|
|||
// being present on OPTIONS. To improve reliability we also accept a
|
||||
// clientKey via query parameter and fall back to matching the origin
|
||||
// against the `whitelistcors` table below.
|
||||
const clientKey = (
|
||||
req.header("x-tenant-key") ||
|
||||
req.header("X-TENANT-KEY") ||
|
||||
req.header("X-Tenant-Key") ||
|
||||
(req.query && (req.query.clientKey || req.query.client_key)) ||
|
||||
""
|
||||
)
|
||||
.toString()
|
||||
.trim();
|
||||
const cacheKey = clientKey || "__default__";
|
||||
const cacheKey = "__default__";
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
|
|
@ -77,7 +68,7 @@ app.use((req, res, next) => {
|
|||
.filter(Boolean);
|
||||
|
||||
const originCors = await db.whitelistcors.findFirst({
|
||||
where: { origin: origin, is_active: "Y" },
|
||||
where: { is_active: "Y" },
|
||||
});
|
||||
if (originCors) {
|
||||
allowedOrigins.push(originCors.origin);
|
||||
|
|
|
|||
Loading…
Reference in New Issue