Skip to content

Commit 17c2a68

Browse files
committed
fix sec-fetch for oidc
1 parent d144f54 commit 17c2a68

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

backend/app.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,22 @@ app.enable("trust proxy", ["loopback", "linklocal", "uniquelocal"]);
2626
app.enable("strict routing");
2727

2828
app.use((req, res, next) => {
29-
if (!["same-origin", undefined, "none"].includes(req.get("sec-fetch-site"))) {
30-
return res.status(403).json({
31-
error: { message: "Rejected Sec-Fetch-Site Value." },
32-
});
29+
if (["same-origin", undefined, "none"].includes(req.get("sec-fetch-site"))) {
30+
return next();
3331
}
34-
next();
32+
33+
if (
34+
req.method === "GET" &&
35+
req.path === "/api/oidc/callback" &&
36+
req.get("sec-fetch-mode") === "navigate" &&
37+
req.get("sec-fetch-dest") === "document"
38+
) {
39+
return next();
40+
}
41+
42+
res.status(403).json({
43+
error: { message: "Rejected Sec-Fetch-Site Value." },
44+
});
3545
});
3646

3747
// pretty print JSON when not live

0 commit comments

Comments
 (0)