You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How should I do x-api-key in serverpod Endpoint? #4892
Having an x-api-key to validate requests is a common practice. However, there isn't a solution works ootb. Unless I'm wrong, but there isn't a way to add customHeaders to the generated Client class. On the server side, there isn't a middleware or plugin to verify all request (or scoping) including such header. We have to have a helper function and make sure it's called on every Endpoint request
Proposal
Add support for customHeaders, and provide middleware/plugin to allow adding guard without having to update all existing endpoints
Use Case
Verifying x-api-key on the server side to validate requests
Alternatives
I can't think of any
Additional context
No response
How experienced are you with this library?
Intermediate - Familiar with the basics or have used it in a few projects
Indeed, currently it is not possible to add arbitrary headers to the client. However, this is something that we should do together with refactoring the routing inside Serverpod (and maybe exposing control over the method and parameters).
Since we already have a detailed issue that covers this request, I'll close this one as duplicated, but feel free to comment there about your use case!
Activity
marcelomendoncasoares commentedon Mar 27, 2026
Hi @thangmoxielabs! Thanks for reaching out!
Indeed, currently it is not possible to add arbitrary headers to the client. However, this is something that we should do together with refactoring the routing inside Serverpod (and maybe exposing control over the method and parameters).
Since we already have a detailed issue that covers this request, I'll close this one as duplicated, but feel free to comment there about your use case!