mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: prevent caching error pages (#17100)
This commit is contained in:
parent
8d54deee4e
commit
031f594fa3
@ -420,7 +420,7 @@ def show_http_exception(ex: HTTPException) -> FlaskResponse:
|
|||||||
and ex.code in {404, 500}
|
and ex.code in {404, 500}
|
||||||
):
|
):
|
||||||
path = resource_filename("superset", f"static/assets/{ex.code}.html")
|
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(
|
return json_errors_response(
|
||||||
errors=[
|
errors=[
|
||||||
@ -442,7 +442,7 @@ def show_command_errors(ex: CommandException) -> FlaskResponse:
|
|||||||
logger.warning(ex)
|
logger.warning(ex)
|
||||||
if "text/html" in request.accept_mimetypes and not config["DEBUG"]:
|
if "text/html" in request.accept_mimetypes and not config["DEBUG"]:
|
||||||
path = resource_filename("superset", "static/assets/500.html")
|
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 {}
|
extra = ex.normalized_messages() if isinstance(ex, CommandInvalidError) else {}
|
||||||
return json_errors_response(
|
return json_errors_response(
|
||||||
@ -464,7 +464,7 @@ def show_unexpected_exception(ex: Exception) -> FlaskResponse:
|
|||||||
logger.exception(ex)
|
logger.exception(ex)
|
||||||
if "text/html" in request.accept_mimetypes and not config["DEBUG"]:
|
if "text/html" in request.accept_mimetypes and not config["DEBUG"]:
|
||||||
path = resource_filename("superset", "static/assets/500.html")
|
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(
|
return json_errors_response(
|
||||||
errors=[
|
errors=[
|
||||||
|
Loading…
Reference in New Issue
Block a user