I'm having trouble with setting the ETag and Cache-Control headers in my Remix application. Despite configuring them in my code, they don't seem to be set when I make a request.
Here's the relevant part of my code:
const data = {
term,
collection,
result,
resultWithoutFacetValueFilters,
facetValueIds,
appliedPaginationLimit,
appliedPaginationPage,
};
const etag = createETag(data);
return json(data, {
headers: {
'Cache-Control': 'public, max-age=18000', // 5 hours
'ETag': etag,
}
});
When I use curl to send a request or make a request from the browser, the Cache-Control and ETag headers are not present in the response. Can anyone help me understand why this is happening and how I can fix it?