-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request CachePolicy isn't applied in HTTP request header #31320
Comments
cc: @davidsh |
Any updates here? I think it's a very basic property. |
Unlike .NET Framework, .NET Core does not have any caching features for HTTP. It does not support .NET Framework related System.Net.Cache features. There are really 2 parts to the caching logic.
(1) can probably be fixed so that we have some compatibility with .NET Framework behavior, at least in terms of what request headers get added to the outgoing HTTP request. (2) is not going to be fixed. There are no plans to add the System.Net.Cache feature to .NET Core. |
@davidsh Thanks for detail explanation. |
The change has to be made to the 'master' branch first which is targeting .NET 5. After that, the change can be considered for .NET Core 3.1. We're getting close to .NET Core 3.1 RTM, so, it's possible it won't make that release. But it could be considered for a servicing release to .NET Core 3.1, i.e. .NET Core 3.1.1, 3.1.2, etc. |
@davidsh that's great, thank you. |
Workaround: HttpWebRequest wr;
wr.Headers.Add("Cache-Control", "no-store,no-cache");
wr.Headers.Add("Pragma", "no-cache"); |
Could you make it a plan? Currently I'm looking at telling our customers how awesome .NET Core is, but errrrr... you should also look forward to slower responses because repeated web requests are no longer relying on fast 304 responses. It's not a very good selling point for moving over from .NET Framework. |
Quick and dirty cache implementation showed a 33x perf increase on repeated requests when implementing cache-control max-age and/or etag:
Test was done on an above-average high-speed internet connection. Effect would of course be A LOT bigger on slower networks. |
Triage: Looks like low priority. HttpWebRequest is deprecated and we recommend everyone to use HttpClient instead. There is a workaround for people who really need it. That said, the work is probably easy and we would take a PR for the part (1) from #31320 (comment) |
Perhaps I was slightly misreading this thread. If it's specific to saying you want a fresh copy from the server, I get it should be sending that. I was conflating it with the settings that also tells the client to pull from the local cache as well if possible (which is also part of the |
Hi. |
Steps:
Actual Behavior
It's observerd that http request header doesn't include the cache setting.
Expected Behavior
Runing with the same code in Console App against .net framework, we can get following request header.
My Question
The text was updated successfully, but these errors were encountered: