strange cache issue, nocache configuration and use cas header but still returning old version

I access Tigris through my own CDN, but I am encountering a very strange caching issue.
If a file is uploaded and then immediately downloaded from my cdn, it returns the old version instead of the new version’s content.

My CDN is configured with the origin address and host set to fly.storage.tigris.dev.
In the following request summary, assume that my CDN address is cdnsample.com.
I always set the X-Tigris-Cas: true request header during the GET request.

before uploading the original version is:
As long as the CDN has previously fetched the file before newer content upload, the issue will occur. If the old version has not been fetched by the CDN, then it works normally.

  request:
    GET /sync/testfile6?AWSAccessKeyId=... HTTP/1.1
    Host: cdnsample.com
    X-Tigris-Cas: true
  response header:
    Cache-Control: no-store
    ETag: "3a9a4039c8a8a71662488a1fa7fc4b7a"
    Last-Modified: Tue, 21 Jan 2025 08:22:01 GMT
    Server: Tigris OS
    server-timing: total;dur=6
    X-Amz-Checksum-Crc32c: RV4Ipg==
    X-Amz-Request-Id: 1737447722223647831
    ...

Uploading a new content:
Whether uploading directly or through the CDN, the same issue will occur.

  request:
    PUT /sync/testfile6?AWSAccessKeyId=... HTTP/1.1
    Host: fly.storage.tigris.dev
    Cache-Control: no-store
    x-amz-checksum-crc32c: 8xtsFQ==
    ...
  response header:
    ETag: "10d1ccbefa7253e3235a46d2c78c1445"
    Server: Tigris OS
    X-Amz-Request-Id: 1737447728406454703
    Date: Tue, 21 Jan 2025 08:22:08 GMT
    ...

download following a 200 response to the upload:
The issue only occurs when fetching from the CDN.

  request :
    GET /sync/testfile6?AWSAccessKeyId=...HTTP/2
    Host: cdnsample.com
    X-Tigris-Cas: true
  response header:
    Date: Tue, 21 Jan 2025 08:22:09 GMT
    Cache-Control: no-store
    ETag: "3a9a4039c8a8a71662488a1fa7fc4b7a"
    Last-Modified: Tue, 21 Jan 2025 08:22:01 GMT
    Server: Tigris OS
    X-Amz-Checksum-Crc32c: RV4Ipg==
    X-Amz-Request-Id: 1737447729124630648
    X-Tigris-Regions: iad
    ...

It can be seen that the response is very strange. The X-Amz-Request-Id and Date in the response have changed, but the file’s metadata and http content are from the previous version. This issue does not occur all the time, but it happens quite frequently.

I don’t to know why the reason for this is and how I can avoid it. Waiting about 1 second before downloading after uploading can prevent this issue, but obviously, it easily leads to inconsistent results.

If I download without using the CDN, this issue does not occur. However, I believe that the CDN is not performing any caching behavior. When using other similar object storage services, I do not encounter similar issues. Additionally, I really need to use my own CDN.

Perhaps you can help me confirm whether the Tigris server responded with the latest content when I mistakenly received an older version.

@sevenup The Date represents the time when the query is responded as you can see here in common response headers page and x-amz-request-id uniquely identifies the request that’s why you see both of them changed as these are on request level.

The CAS headers in get request works when conditional checks are used during Put so that Get can be routed to the proper region to provide consistent read so in your case you don’t need that header.

If I download without using the CDN, this issue does not occur.

As you mentioned that issue doesn’t occur without CDN so I think there is caching happening at CDN level. What happens if you use this header during get request Cache-Control: no-cache?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.