Skip to content

Commit cf6f059

Browse files
authored
Improve http cache header
1 parent d1d2c74 commit cf6f059

File tree

1 file changed

+5
-2
lines changed
  • working-with-response/http-cache-header

1 file changed

+5
-2
lines changed

working-with-response/http-cache-header/index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ When this middleware attached to route, additional steps is taken:
3232
- If method is not cacheable (not GET nor HEAD) then nothing is done else,
3333
- `Cache-Control` header is added to response header,
3434
- If ETag is used then MD5 hash of response body is computed and `ETag` header is added to response with hash value of response body.
35-
- If request contains `If-None-Match` header, its value is compared with ETag value, if they are matched or `If-Non-Match` equals `"*"`, then response is considered not modified.
36-
- If response contains header `Last-Modified` and request contains header `If-Modified-Since`, both headers values are compared. If `Last-Modified` is older then response is considered not modified.
35+
- If request contains `If-None-Match` header, its value is compared with ETag value, if they are matched or `If-None-Match` equals `"*"`, then response is considered not modified.
36+
- If ETag comparison return false and response contains header `Last-Modified` and request contains header `If-Modified-Since`, both headers values are compared. If `Last-Modified` is older then response is considered not modified.
3737
- If response is not modified, instance `TNotModifiedResponse` is returned instead. Read [Not modified response](/working-with-response#not-modified-response) section for more information this class.
3838

39+
Read [source code](https://github.com/fanoframework/fano/blob/master/src/Middleware/BuiltIns/CacheControlMiddlewareImpl.pas)
40+
if you want to know more.
41+
3942
## Setting Cache-Control header value
4043

4144
### Set type

0 commit comments

Comments
 (0)