refresh-policy.py (478B)
1 def main(request, _response): 2 response_headers = [("Content-Type", "text/html")] 3 4 body = "<!doctype html>" 5 6 url = request.GET.first(b"url", b"").decode() 7 if url: 8 response_headers.append(("Refresh", "0; url=" + url)) 9 body += "Refreshing to %s" % url 10 else: 11 body += "Not refreshing" 12 13 policy = request.GET.first(b"policy", b"").decode() 14 response_headers.append(("Referrer-Policy", policy)) 15 16 return 200, response_headers, body