aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-17 16:16:53 +0100
committerKim Alvefur <zash@zash.se>2019-11-17 16:16:53 +0100
commit1421714628a9f35f20e4154e031f49c70fd29672 (patch)
treee0911315113c671f2768a6d258e7fee39673f6c6
parent33e92de38717fce322d4c2a6ddd8b5c7be0b1c46 (diff)
downloadprosody-1421714628a9f35f20e4154e031f49c70fd29672.tar.gz
prosody-1421714628a9f35f20e4154e031f49c70fd29672.zip
mod_http_errors: Show a friendly page instead of 404 on top level
-rw-r--r--plugins/mod_http_errors.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/mod_http_errors.lua b/plugins/mod_http_errors.lua
index 2bb13298..2158b403 100644
--- a/plugins/mod_http_errors.lua
+++ b/plugins/mod_http_errors.lua
@@ -75,3 +75,15 @@ module:hook_object_event(server, "http-error", function (event)
end
return get_page(event.code, (show_private and event.private_message) or event.message);
end);
+
+module:hook_object_event(server, "http-error", function (event)
+ local request, response = event.request, event.response;
+ if request and response and request.path == "/" and response.status_code == 404 then
+ response.headers.content_type = "text/html; charset=utf-8";
+ return render(html, {
+ title = "Prosody is running!";
+ message = "Welcome to the XMPP world!";
+ });
+ end
+end, 1);
+