Skip to content

Commit 8eaa2f4

Browse files
committed
🚧 set custom header in static directory
1 parent d251de8 commit 8eaa2f4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

siwe-oidc-js/src/routes/oidc.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@ import { SiweMessage } from 'siwe';
66

77
const router = express.Router();
88

9+
const customHeaders = (res, path, stat) => {
10+
res.append("Cross-Origin-Opener-Policy", "same-origin-allow-popups");
11+
}
12+
913
// Serve static files from the static directory
10-
router.use(express.static('static'));
14+
router.use(express.static('static', { setHeaders: customHeaders }));
1115

1216
// Serve the main index.html file on the base route
1317
router.get('/', (req, res) => {
18+
// Try a different approach since previous methods didn't work
19+
// First send the header, then use a callback to send the file
20+
// res.header('Cross-Origin-Opener-Policy', 'same-origin-allow-popups');
1421
res.sendFile('index.html', { root: 'static' });
1522
});
1623

0 commit comments

Comments
 (0)