Skip to content

Commit a971c12

Browse files
committed
Allow any origin
1 parent b4abfb6 commit a971c12

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

web/pages/api/build-id.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ import path from 'path';
22
import fs from 'fs';
33

44
export default function handler(req: any, res: any) {
5+
res.setHeader('Access-Control-Allow-Origin', '*');
6+
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
7+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
8+
9+
if (req.method === 'OPTIONS') {
10+
// Handle preflight
11+
res.status(200).end();
12+
return;
13+
}
14+
515
const buildId = fs.readFileSync(path.join(process.cwd(), '.next', 'BUILD_ID'), 'utf8').trim();
616
res.setHeader('Cache-Control', 's-maxage=31536000, stale-while-revalidate');
717
res.status(200).json({ buildId });

0 commit comments

Comments
 (0)