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

Add Cache-Control "no-store" to all dynamically generated content #39550

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions airflow/www/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from airflow.www.extensions.init_robots import init_robots
from airflow.www.extensions.init_security import (
init_api_experimental_auth,
init_cache_control,
init_check_user_active,
init_xframe_protection,
)
Expand Down Expand Up @@ -180,6 +181,7 @@ def create_app(config=None, testing=False):

init_jinja_globals(flask_app)
init_xframe_protection(flask_app)
init_cache_control(flask_app)
init_airflow_session_interface(flask_app)
init_check_user_active(flask_app)
return flask_app
Expand Down
9 changes: 9 additions & 0 deletions airflow/www/extensions/init_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ def init_api_experimental_auth(app):
raise AirflowException(err)


def init_cache_control(app):
def apply_cache_control(response):
if "Cache-Control" not in response.headers:
response.headers["Cache-Control"] = "no-store"
return response

app.after_request(apply_cache_control)


def init_check_user_active(app):
@app.before_request
def check_user_active():
Expand Down