Skip to content

Commit c187785

Browse files
Fix custom middleware limitations (#18178)
* Fix #18177 * Document also 3.0, fix typo * Update middleware.md * Update middleware.md * Update middleware.md * Update middleware.md * #18177: update middleware.md Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
1 parent bf1aca1 commit c187785

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

aspnetcore/performance/caching/middleware.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ The sample app adds headers to control caching on subsequent requests:
3838

3939
[!code-csharp[](middleware/samples_snippets/3.x/AddHeaders.cs)]
4040

41+
<!-- make same change here once approved -->
42+
4143
Response Caching Middleware only caches server responses that result in a 200 (OK) status code. Any other responses, including [error pages](xref:fundamentals/error-handling), are ignored by the middleware.
4244

4345
> [!WARNING]
@@ -178,6 +180,10 @@ The sample app adds headers to control caching on subsequent requests:
178180

179181
[!code-csharp[](middleware/samples_snippets/2.x/AddHeaders.cs)]
180182

183+
The preceding headers are not written to the response and are overriden when a controller, action, or Razor Page:
184+
185+
* Has a [[ResponseCache]](xref:Microsoft.AspNetCore.Mvc.ResponseCacheAttribute) attribute. This applies even if a property isn't set. For example, omitting the [VaryByHeader] property (/aspnet/core/performance/caching/response#vary) will cause the corresponding header to be removed from the response.
186+
181187
Response Caching Middleware only caches server responses that result in a 200 (OK) status code. Any other responses, including [error pages](xref:fundamentals/error-handling), are ignored by the middleware.
182188

183189
> [!WARNING]

0 commit comments

Comments
 (0)