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

feat: redirect 404/500 to static pages #14677

Merged
merged 2 commits into from
May 19, 2021

Conversation

betodealmeida
Copy link
Member

SUMMARY

We're currently returning a SIP-40 error payload on 404 and 500. I changed it to redirect the user to the static pages for these errors instead when running in production (not development).

@samtfm, @willbarrett how is this handled on the Preset side?

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screenshot_2021-05-17 Screenshot

After:

Screenshot_2021-05-17 404 Not found Superset

Screenshot_2021-05-17 500 Internal server error S uperset

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented May 17, 2021

Codecov Report

Merging #14677 (60beedc) into master (eb9dafc) will decrease coverage by 0.23%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14677      +/-   ##
==========================================
- Coverage   77.55%   77.31%   -0.24%     
==========================================
  Files         958      958              
  Lines       48549    48552       +3     
  Branches     5702     5703       +1     
==========================================
- Hits        37651    37538     -113     
- Misses      10697    10814     +117     
+ Partials      201      200       -1     
Flag Coverage Δ
hive ?
javascript 72.52% <ø> (+0.01%) ⬆️
mysql 81.38% <66.66%> (-0.01%) ⬇️
postgres 81.40% <66.66%> (-0.01%) ⬇️
presto ?
python 81.48% <66.66%> (-0.46%) ⬇️
sqlite 81.02% <66.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/views/base.py 76.00% <66.66%> (-0.20%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/db_engine_specs/hive.py 70.32% <0.00%> (-17.08%) ⬇️
superset/db_engine_specs/presto.py 83.36% <0.00%> (-6.95%) ⬇️
...rontend/src/components/ListView/Filters/Search.tsx 82.35% <0.00%> (-4.32%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/connectors/sqla/models.py 88.40% <0.00%> (-1.70%) ⬇️
superset/db_engine_specs/base.py 88.04% <0.00%> (-0.42%) ⬇️
superset/models/core.py 89.51% <0.00%> (-0.27%) ⬇️
superset/utils/core.py 88.87% <0.00%> (-0.13%) ⬇️
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb9dafc...60beedc. Read the comment docs.

Comment on lines 367 to 370
if not config["DEBUG"] and ex.code == 404:
return redirect("/static/assets/404.html")
if not config["DEBUG"] and ex.code == 500:
return redirect("/static/assets/500.html")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update this to redirect only non-API calls.

@willbarrett
Copy link
Member

@betodealmeida we haven't integrated these yet in Preset, it's a perpetual backlog item :). LGTM

@betodealmeida betodealmeida merged commit c3d1f10 into apache:master May 19, 2021
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
* feat: redirect 404/500 to static pages

* Show pages only on html requests
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
* feat: redirect 404/500 to static pages

* Show pages only on html requests
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
* feat: redirect 404/500 to static pages

* Show pages only on html requests
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants