Merge pull request #521 from dotnet-maestro-bot/merge/release/2.2-to-master
[automated] Merge branch 'release/2.2' => 'master'
This commit is contained in:
Коммит
3e6b3a0067
|
@ -71,7 +71,7 @@ namespace Microsoft.AspNetCore.Diagnostics.HealthChecks
|
|||
|
||||
httpContext.Response.StatusCode = statusCode;
|
||||
|
||||
if (!_healthCheckOptions.SuppressCacheHeaders)
|
||||
if (!_healthCheckOptions.AllowCachingResponses)
|
||||
{
|
||||
// Similar to: https://github.com/aspnet/Security/blob/7b6c9cf0eeb149f2142dedd55a17430e7831ea99/src/Microsoft.AspNetCore.Authentication.Cookies/CookieAuthenticationHandler.cs#L377-L379
|
||||
var headers = httpContext.Response.Headers;
|
||||
|
|
|
@ -48,11 +48,19 @@ namespace Microsoft.AspNetCore.Diagnostics.HealthChecks
|
|||
public Func<HttpContext, HealthReport, Task> ResponseWriter { get; set; } = HealthCheckResponseWriters.WriteMinimalPlaintext;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value that controls whether the health check middleware will add HTTP headers to prevent
|
||||
/// response caching. If the value is <c>false</c> the health check middleware will set or override the
|
||||
/// Gets or sets a value that controls whether responses from the health check middleware can be cached.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The health check middleware does not perform caching of any kind. This setting configures whether
|
||||
/// the middleware will apply headers to the HTTP response that instruct clients to avoid caching.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the value is <c>false</c> the health check middleware will set or override the
|
||||
/// <c>Cache-Control</c>, <c>Expires</c>, and <c>Pragma</c> headers to prevent response caching. If the value
|
||||
/// is <c>true</c> the health check middleware will not modify the cache headers of the response.
|
||||
/// </summary>
|
||||
public bool SuppressCacheHeaders { get; set; }
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public bool AllowCachingResponses { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ namespace Microsoft.AspNetCore.Diagnostics.HealthChecks
|
|||
{
|
||||
app.UseHealthChecks("/health", new HealthCheckOptions()
|
||||
{
|
||||
SuppressCacheHeaders = true,
|
||||
AllowCachingResponses = true,
|
||||
});
|
||||
})
|
||||
.ConfigureServices(services =>
|
||||
|
|
Загрузка…
Ссылка в новой задаче