Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set X-Clacks-Overhead to keep Terry Pratchett in the network #61

Merged
merged 1 commit into from
May 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions canonicalwebteam/flask_base/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ def set_permissions_policy_headers(response):
return response


def set_clacks(response):
"""
Keep Sir Terry Pratchett's name alive
https://xclacksoverhead.org/home/about
"""

response.headers["X-Clacks-Overhead"] = "GNU Terry Pratchett"

return response


class FlaskBase(flask.Flask):
def send_static_file(self, filename: str) -> "flask.wrappers.Response":
"""
Expand Down Expand Up @@ -219,6 +230,7 @@ def __init__(
self.after_request(set_security_headers)
self.after_request(set_cache_control_headers)
self.after_request(set_permissions_policy_headers)
self.after_request(set_clacks)

self.context_processor(base_context)

Expand Down