mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
feat: redirect 404/500 to static pages (#14677)
* feat: redirect 404/500 to static pages * Show pages only on html requests
This commit is contained in:
parent
065b3f933d
commit
c3d1f1084e
@ -385,6 +385,13 @@ def refresh_csrf_token(ex: CSRFError) -> FlaskResponse:
|
||||
@superset_app.errorhandler(HTTPException)
|
||||
def show_http_exception(ex: HTTPException) -> FlaskResponse:
|
||||
logger.warning(ex)
|
||||
if (
|
||||
"text/html" in request.accept_mimetypes
|
||||
and not config["DEBUG"]
|
||||
and ex.code in {404, 500}
|
||||
):
|
||||
return redirect(f"/static/assets/{ex.code}.html")
|
||||
|
||||
return json_errors_response(
|
||||
errors=[
|
||||
SupersetError(
|
||||
|
Loading…
Reference in New Issue
Block a user