Respond with 403 when features are disabled
When administrators disabled features and users tried to access them with the browser, we were responding with a 500 "Internal Server Error" page, which in my humble opinion was incorrect. There was no error at all; the server worked exactly as expected. I think a 403 "Forbidden" code is better; since that feature is disabled, we're refusing to let users access it. We could also respond with a 404 "Not found", although I wonder whether that'll be confusing when administrators temporarily or accidentally disable a feature. A similar thing might happen if we responded with a 410 "Gone" code. Actually this case might be more confusing since users aren't that familiar with this code. In any case, all these options are better than the 500 error.
This commit is contained in:
41
public/403.html
Normal file
41
public/403.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Error 403 | Forbidden: Access disabled</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
body {
|
||||
background: #065687 url('/errors_bg.jpg');
|
||||
color: #2E2F30;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: white;
|
||||
font-size: 160px;
|
||||
line-height: 160px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: white;
|
||||
}
|
||||
|
||||
div.error {
|
||||
margin-top: -144px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="error">
|
||||
<h1>403</h1>
|
||||
<h2>Access to this page has been disabled by the administrators.</h2>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user