Skip to content
Discussion options

You must be logged in to vote

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).

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/…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gopeter
Comment options

Answer selected by gopeter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants