cached_pragma_rand.py (599B)
1 def main(request, response): 2 # Disable non-standard XSS protection 3 response.headers.set(b"X-XSS-Protection", b"0") 4 response.headers.set(b"Content-Type", b"text/html") 5 6 # Set caching headers 7 # According to rfc9111 Pragma: no-cache is deprecated, so we expect 8 # Cache-Control to take precedence when there's a mismatch. 9 response.headers.set(b"Cache-Control", b"max-age=2592000, public") 10 response.headers.set(b"Pragma", b"no-cache") 11 12 # Include a timestamp to verify caching behavior 13 import time 14 response.content = f"Timestamp: {time.time()}".encode('utf-8')