diff --git a/tests/unit/test_web.py b/tests/unit/test_web.py index f0142ab38a..19fcbe9f05 100755 --- a/tests/unit/test_web.py +++ b/tests/unit/test_web.py @@ -109,6 +109,7 @@ class TestWeb(BaseTestWeb): self.assertIn('Access-Control-Allow-Origin', resp.headers) self.assertIn('Cache-Control', resp.headers) self.assertIn('Last-Modified', resp.headers) + self.assertTrue(resp.headers['Last-Modified'].endswith(' GMT')) self.executor_server.hold_jobs_in_build = False self.executor_server.release() diff --git a/zuul/web/__init__.py b/zuul/web/__init__.py index e4e2868ac3..c90f9cb8e3 100755 --- a/zuul/web/__init__.py +++ b/zuul/web/__init__.py @@ -21,6 +21,7 @@ from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool from ws4py.websocket import WebSocket import codecs import copy +from datetime import datetime import json import logging import os @@ -245,7 +246,9 @@ class ZuulWebAPI(object): resp = cherrypy.response resp.headers["Cache-Control"] = "public, max-age=%d" % \ self.cache_expiry - resp.headers["Last-modified"] = self.cache_time[tenant] + last_modified = datetime.utcfromtimestamp(self.cache_time[tenant]) + last_modified_header = last_modified.strftime('%a, %d %b %Y %X GMT') + resp.headers["Last-modified"] = last_modified_header resp.headers['Access-Control-Allow-Origin'] = '*' return payload