I am trying to set the Cache-Control header to the response for a GET request.
This works with OPTIONS queries:
PreRequestFilters.Add((httpRequest, httpResponse) =>
{
if (httpRequest.HttpMethod == "OPTIONS")
{
httpResponse.AddHeader("Cache-Control", "no-cache");
httpResponse.EndServiceStackRequest();
}
});
This does not work with GET requests:
ResponseFilters.Add((httpRequest, httpResponse, dto) =>
{
httpResponse.AddHeader("Cache-Control", "no-cache");
});
Filters work ... I can also add my own headers to the response using the above method.
I am using 3.9.58.
So, is this a mistake (in ServiceStack or in my code), or is it by design due to the nature of the REST and GET requests?
source
share