Skip to content

I am curious that redirect() in server action works differently between production and development is correct. #77010

Open
@yongholeeme

Description

@yongholeeme

Link to the code that reproduces this issue

https://github.com/yongholeeme/reproduction-bug-redirect-in-server-action-between-prod-and-dev

To Reproduce

In developement

  1. Start the application in development (next dev)
  2. Click redirect in server actions to /test
  3. x-action-redirect header is empty
    • There are two response: server action response and an unknown rsc payload quest

In production

  1. Start the application in production (next build && next dev)
  2. Click redirect in server actions to /test
  3. x-action-redirect header exists
    • There is an only server action response

Current vs. Expected behavior

I found that ⁠redirect() in server actions works differently between production and development environments. In production, a server action request that redirects to '/test' returns a 303 Response that has RSC payloads. However, in development, despite this, an unknown request with an RSC payload still occurs. Does it work correctly?

production

prod.mov

development

dev.mov

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:06:23 PDT 2024; root:xnu-11215.41.3~3/RELEASE_ARM64_T8132
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.15.4
Relevant Packages:
  next: 15.3.0-canary.1 // Latest available version is detected (15.3.0-canary.1).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Server Actions

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions