mirror of https://github.com/apache/superset.git
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
|
@ -94,7 +94,7 @@
|
|||
<section>
|
||||
<h1>Page not found</h1>
|
||||
<p>
|
||||
Sorry, we cannot find t he page you are looking for. You may have
|
||||
Sorry, we cannot find the page you are looking for. You may have
|
||||
mistyped the address or the page may have moved.
|
||||
</p>
|
||||
<a href="/" class="button">Back to home</a>
|
||||
|
|
|
@ -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