Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

[🐛 Bug]: 301 Moved Permanently from middleware ended up with 307 Temporary Redirect #808

@strofimo

Description

@strofimo

next-on-pages environment related information

System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Mar 29 23:14:13 UTC 2024
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 15 GB
Shell: /bin/bash
Package Manager Used: npm (9.6.3)

Relevant Packages:
@cloudflare/next-on-pages: 1.11.3
vercel: 34.2.4
next: 14.1.0

Description

Cloudflare next-on-pages do 307 redirect while it has to be 301.

Reproduction

I have created a minimal reproducible example in this repo

How to set it up

git clone https://github.com/strofimo/cf-middleware-move-permanently.git
cd cf-middleware-move-permanently
npm i

Run NextJS Dev to see what are the expected redirect result

npm run dev
# accessing http://localhost:3000 lead to 301 Moved Permanently
# ▲ Next.js 14.1.0
# - Local:        http://localhost:3000

This is the expected behave for a next js app.

Run Cloudflare pages preview using wrangler

npm run preview
# accessing http://localhost:8788 lead to 307 Temporary Redirect
# [wrangler:inf] Ready on http://localhost:8788

Pages Deployment Method

None

Pages Deployment ID

No response

Additional Information

No response

Would you like to help?

  • Would you like to help fixing this bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions