Skip to content

Header returned from headers function within a route doesn't override same-name header in entry.server #14299

@eugeniobet

Description

@eugeniobet

Reproduction

Define an header in entry.server.tsx file with the name "X-Test" and give it a value,
visit a route which exports an headers function which returns an object with the same "X-Test" and a different value.
Watch the value returned being the one originally defined in entry.server.tsx

System Info

System:
    OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster)
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-1235U
    Memory: 7.89 GB / 15.34 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
    Watchman: 4.9.0 - /usr/bin/watchman
  Browsers:
    Chrome: 129.0.6668.100
  npmPackages:
    @react-router/dev: 7.8.2 => 7.8.2 
    @react-router/express: 7.8.2 => 7.8.2 
    @react-router/node: 7.8.2 => 7.8.2 
    @react-router/remix-config-routes-adapter: 0.0.0-nightly-bf7ecb711-20240911 => 0.0.0-nightly-bf7ecb711-20240911 
    @react-router/serve: 7.8.2 => 7.8.2 
    react-router: 7.8.2 => 7.8.2 
    vite: 5.4.2 => 5.4.2

Used Package Manager

npm

Expected Behavior

The route header to have priority over the entry.server.tsx one

Actual Behavior

The opposite of the expected behaviour

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions