Skip to content

badgen.net don't respect cache option #648

@zhongfly

Description

@zhongfly

As doc said,we can use https://flat.badgen.net/.....?cache=300 to control cache time. But this option is no longer work.
From reponse header,I find the cache-control don't use the value set in 'cache' option:

curl --head https://flat.badgen.net/static/color/blue/blue?cache=300

HTTP/1.1 200 OK
Age: 0
Cache-Control: public, max-age=86400
Connection: keep-alive
Content-Length: 0
Content-Type: image/svg+xml;charset=utf-8
Date: Sat, 23 Sep 2023 02:58:26 GMT
Etag: "13lt1lma0fyiu"
Server: Vercel
Strict-Transport-Security: max-age=63072000
X-Matched-Path: /api/static
X-Vercel-Cache: MISS
X-Vercel-Id: sin1::sin1::wblkh-1695437906444-6252f7b3db1f

Cache-Control should be max-age=300 not max-age=86400 because I set '300' in cache option.

It will result the badgen which used in github and cache by github not update as expected, because github determines whether to update its image cache via Cache-Control.
ref: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-anonymized-urls#an-image-that-changed-recently-is-not-updating

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions