Setting request headers
Hi, how do I set the request headers so that I can pass an Authorization token in requests to server functions?
4 Replies
wise-white•2mo ago
I feel this is what you want
https://tanstack.com/start/latest/docs/framework/react/middleware#modifying-the-client-request
Middleware | TanStack Start React Docs
What is Server Function Middleware? Middleware allows you to customize the behavior of server functions created with createServerFn with things like shared validation, context, and much more. Middlewa...
wise-white•2mo ago
Using middleware
deep-jadeOP•2mo ago
Perfect, thank you!
How do I register the global middleware? I have a
global-middleware.ts
file but I'm not using app/
as a directory.
Ah, adding it to __root workedwise-white•2mo ago
Yeah I think it used to auto pick it up but not anymore