Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't override headers via middleware #71604

Open
mrmckeb opened this issue Oct 22, 2024 · 1 comment
Open

Can't override headers via middleware #71604

mrmckeb opened this issue Oct 22, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template. Middleware Related to Next.js Middleware.

Comments

@mrmckeb
Copy link
Contributor

mrmckeb commented Oct 22, 2024

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/great-elbakyan-jty6yh

To Reproduce

Start the application and inspect the headers. You'll see that new headers can be added, but existing headers can't be modified.

Current vs. Expected behavior

We should be able to replace or remove headers when rewriting.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Wed Jul 31 20:50:54 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T8122
  Available memory (MB): 24576
  Available CPU cores: 8
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: 9.12.2
Relevant Packages:
  next: 15.0.0 // Latest available version is detected (15.0.0).
  eslint-config-next: N/A
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
  typescript: 5.6.3
Next.js Config:
  output: N/A

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

Middleware

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

next dev (local)

Additional context

We have a small Next.js app that is designed to proxy between two other apps sharing a single domain.

These apps have headers that we want to modify/remove when their pages are served via the proxy.

We can add headers, but we are not able to modify or remove headers.

@mrmckeb mrmckeb added the bug Issue was opened via the bug report template. label Oct 22, 2024
@github-actions github-actions bot added the Middleware Related to Next.js Middleware. label Oct 22, 2024
@amannn
Copy link
Contributor

amannn commented Oct 22, 2024

Maybe related: #69000 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Middleware Related to Next.js Middleware.
Projects
None yet
Development

No branches or pull requests

2 participants