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
commitdfa2bdffc083faa597509d7f35125c41f6ffbc9d (patch)
treee0911315113c671f2768a6d258e7fee39673f6c6
parent8703eaa89a6cf42d6fe4d8e1083bbb029afcf7e9 (diff)
downloadprosody-dfa2bdffc083faa597509d7f35125c41f6ffbc9d.tar.gz
prosody-dfa2bdffc083faa597509d7f35125c41f6ffbc9d.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);
+