Skip to content

Commit

Permalink
Middleware move permanently fix (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
strofimo authored Jun 24, 2024
1 parent fa751e3 commit d3caf91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-socks-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudflare/next-on-pages': patch
---

Middleware move permanently fix
6 changes: 6 additions & 0 deletions packages/next-on-pages/templates/_worker.js/routes-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ export class RoutesMatcher {
// to continue and did not rewrite/redirect the URL.
this.body = resp.body;
this.status = resp.status;
} else if (
resp.headers.has('location') &&
resp.status >= 300 &&
resp.status < 400
) {
this.status = resp.status;
}

applyHeaders(this.headers.normal, resp.headers);
Expand Down

0 comments on commit d3caf91

Please sign in to comment.