Browse Source

web: set cache-control header for the badge endpoint

This change enables displaying the correct badge by forcing the
cache to be disabled as recommended by:

https://docs.github.com/en/github/authenticating-to-github/about-anonymized-image-urls#an-image-that-changed-recently-is-not-updating

Change-Id: I92a831d62a626d2f066f40c3358e19260de8cbdd
changes/54/778054/1
Tristan Cacqueray 1 month ago
parent
commit
86f588e97f
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      zuul/web/__init__.py

+ 3
- 0
zuul/web/__init__.py View File

@ -1057,6 +1057,9 @@ class ZuulWebAPI(object):
file = 'failing.svg'
path = os.path.join(self.zuulweb.static_path, file)
# Ensure the badge are not cached
cherrypy.response.headers['Cache-Control'] = "no-cache"
return cherrypy.lib.static.serve_file(
path=path, content_type="image/svg+xml")


Loading…
Cancel
Save