From 23f261c99d823989fa48ea66acbc93ebca1099cb Mon Sep 17 00:00:00 2001 From: Rudraksh Mishra Date: Wed, 20 May 2026 09:57:56 +0530 Subject: [PATCH] feat: add 403 forbidden error handler --- app.py | 5 +++++ templates/403.html | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 templates/403.html diff --git a/app.py b/app.py index 59a5a05..21b2c80 100644 --- a/app.py +++ b/app.py @@ -37,6 +37,11 @@ def method_not_allowed(error): """Render a friendly 405 page when the wrong HTTP method is used.""" return render_template("405.html"), 405 +@app.errorhandler(403) +def forbidden(error): + """Render a friendly 403 page when access is denied.""" + return render_template("403.html"), 403 + if __name__ == "__main__": # debug=True is only for local development. diff --git a/templates/403.html b/templates/403.html new file mode 100644 index 0000000..90c628f --- /dev/null +++ b/templates/403.html @@ -0,0 +1,25 @@ + + + + + + Forbidden — DevPath + + + + + +
+
+
403
+

Forbidden

+

You do not have permission to access this page.

+ Back to Home +
+
+ + \ No newline at end of file