#software-engineering
> [!info] original post
> [Setting headers for server response · trpc/trpc · Discussion #1985 (github.com)](https://github.com/trpc/trpc/discussions/1985)
Couple of solutions:
1. Use the `responseMeta` function ([https://trpc.io/docs/nextjs#responsemeta-callback](https://trpc.io/docs/nextjs#responsemeta-callback)).
2. Pass your Response object (`res`) into `ctx` with the `createContext` function then use `res.header(...)` inside your resolve fn.
```ts
export const createContext = async ({ req, res }: CreateExpressContextOptions) => {
return { req, res };
};
...
.query('...', {
...,
resolve: async ({ ctx }) => {
ctx.res.header('x-custom-header', 'hello123');
...
},
}
```
%%
[[TRPC]]
%%