Skip to content

Commit

Permalink
fix: prevent caching error pages (#17100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Ritter committed Oct 13, 2021
1 parent 8d54dee commit 031f594
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions superset/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def show_http_exception(ex: HTTPException) -> FlaskResponse:
and ex.code in {404, 500}
):
path = resource_filename("superset", f"static/assets/{ex.code}.html")
return send_file(path), ex.code
return send_file(path, cache_timeout=0), ex.code

return json_errors_response(
errors=[
Expand All @@ -442,7 +442,7 @@ def show_command_errors(ex: CommandException) -> FlaskResponse:
logger.warning(ex)
if "text/html" in request.accept_mimetypes and not config["DEBUG"]:
path = resource_filename("superset", "static/assets/500.html")
return send_file(path), 500
return send_file(path, cache_timeout=0), 500

extra = ex.normalized_messages() if isinstance(ex, CommandInvalidError) else {}
return json_errors_response(
Expand All @@ -464,7 +464,7 @@ def show_unexpected_exception(ex: Exception) -> FlaskResponse:
logger.exception(ex)
if "text/html" in request.accept_mimetypes and not config["DEBUG"]:
path = resource_filename("superset", "static/assets/500.html")
return send_file(path), 500
return send_file(path, cache_timeout=0), 500

return json_errors_response(
errors=[
Expand Down

0 comments on commit 031f594

Please sign in to comment.