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
This commit is contained in:
Tristan Cacqueray 2021-03-01 19:22:43 +00:00
parent 8673a6ca6f
commit 86f588e97f
1 changed files with 3 additions and 0 deletions

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")