-
So I have a route like But: this applies for document loading only, not for the data requests. I know I can set some headers with Is this possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Each loader can return headers, including export const loader: LoaderFunction = async ({request}) => {
// get data
...
return json(data, { status: 200, headers: { 'cache-control': 'no-cache' }})
} You can also specify document headers that should be applied to the route. You have access to the current loader headers as well as all the parent headers (headers are merged from root to leaf) export const headers: HeadersFunction = ({ loaderHeaders, parentHeaders }) => {
return { 'cache-control': loaderHeaders.get("cache-control") }
} https://remix.run/docs/en/v1/api/conventions#headers The |
Beta Was this translation helpful? Give feedback.
Each loader can return headers, including
cache-control
as part of the response. These headers will be used when Remix makes data requests (client-side navigation).You can also specify document headers that should be applied to the route. You have access to the current loader headers as well as all the parent headers (headers are merged from root to leaf)
https://remix.run/docs/en/v1/…