Skip to content

Commit bb30d29

Browse files
committed
Remove standard CSRF middleware for lax-proto
Previously, two CSRF middlewares were added for lax-proto requests: one at the beginning and one at the end. This change replaces them with a single middleware placed at the beginning. Non-lax-proto cases remain unchanged.
1 parent ea22cc2 commit bb30d29

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/curvy-glasses-wash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@builder.io/qwik-city': patch
3+
---
4+
5+
fix behaviour of checkOrigin: "lax-proto" in createQwikCity

packages/qwik-city/src/middleware/request-handler/resolve-request-handlers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ export const resolveRequestHandlers = (
6666
checkOrigin &&
6767
(method === 'POST' || method === 'PUT' || method === 'PATCH' || method === 'DELETE')
6868
) {
69-
requestHandlers.unshift(csrfCheckMiddleware);
70-
7169
if (checkOrigin === 'lax-proto') {
72-
requestHandlers.push(csrfLaxProtoCheckMiddleware);
70+
requestHandlers.unshift(csrfLaxProtoCheckMiddleware);
71+
} else {
72+
requestHandlers.unshift(csrfCheckMiddleware);
7373
}
7474
}
7575
if (isPageRoute) {

0 commit comments

Comments
 (0)