I have the following attribute declaration over an action: [ResponseCache(Location = ResponseCacheLocation.Client, Duration = 1800)]
This works great - I can see the browser using disk cache instead of reading the information from the server again. However, it still fires off each preflight request for some reason. That's really unnecessary, and I'd like to get rid of this. How can I give the same cache treatment to the preflight request associated with this endpoint?
edit:
After seeing a suggestion below, I changed this:
{
builder
.AllowCredentials()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.WithOrigins("yadda");
}
to this:
{
builder
.AllowCredentials()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.SetPreflightMaxAge(TimeSpan.FromHours(1))
.WithOrigins("yadda");
}
which resulted in this traffic in the network tab where I can see the OPTIONS request going out almost every time despite these requests all taking place within seconds of one another and the GET being retrieved from disk cache:
Here are the response headers which display: