Which project does this relate to?
Start
Describe the bug
It is not possible to set multiple headers using the redirect() method with the Headers() interface, because all headers are ignored in this case:
import { redirect } from '@tanstack/react-router';
import { createServerFn } from '@tanstack/react-start';
export const action = createServerFn({ method: 'GET' }).handler(() => {
const headers = new Headers()
headers.append('x-example', 'a')
headers.append('x-example', 'b')
throw redirect({ to: '/', headers }) // no response headers
// throw redirect({ to: '/', headers: { 'x-example': 'c' } }) // works
})
Your Example Website or App
https://tanstack.com/start/latest/docs/framework/react/examples/start-basic?path=examples%2Freact%2Fstart-basic%2Fsrc%2Futils%2Fposts.tsx
Steps to Reproduce the Bug or Issue
- Create a server function with
redirect()
- Pass a
Headers() object to redirect()
- Make a request and check the response headers
Expected behavior
Headers should be present in the response
Screenshots or Videos
No response
Platform
- OS: any
- Browser: any
- Version: latest on Apr 24, 2025 (1.117.0)
Additional context
No response
Which project does this relate to?
Start
Describe the bug
It is not possible to set multiple headers using the
redirect()method with theHeaders()interface, because all headers are ignored in this case:Your Example Website or App
https://tanstack.com/start/latest/docs/framework/react/examples/start-basic?path=examples%2Freact%2Fstart-basic%2Fsrc%2Futils%2Fposts.tsx
Steps to Reproduce the Bug or Issue
redirect()Headers()object toredirect()Expected behavior
Headers should be present in the response
Screenshots or Videos
No response
Platform
Additional context
No response