Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export const createRedirectionIoMiddleware = (config) => {
if (!useFetch) {
return response ?? next();
}
// Disable for server-actions and components.
if (request.headers.get('Next-Action')?.length || request.headers.get('Accept') === "text/x-component") {
return response ?? next();
}

const fetchResponse = await fetch(request, {
redirect: "manual",
cache: "no-store",
Expand Down
4 changes: 4 additions & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export const createRedirectionIoMiddleware = (config: CreateMiddlewareConfig): M
if (!useFetch) {
return response ?? next();
}
// Disable for server-actions and components.
if (request.headers.get('Next-Action')?.length || request.headers.get('Accept') === "text/x-component") {
return response ?? next();
}

const fetchResponse = await fetch(request, {
redirect: "manual",
Expand Down