diff options
author | Kim Alvefur <zash@zash.se> | 2019-11-17 16:16:53 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-11-17 16:16:53 +0100 |
commit | dfa2bdffc083faa597509d7f35125c41f6ffbc9d (patch) | |
tree | e0911315113c671f2768a6d258e7fee39673f6c6 /plugins | |
parent | 8703eaa89a6cf42d6fe4d8e1083bbb029afcf7e9 (diff) | |
download | prosody-dfa2bdffc083faa597509d7f35125c41f6ffbc9d.tar.gz prosody-dfa2bdffc083faa597509d7f35125c41f6ffbc9d.zip |
mod_http_errors: Show a friendly page instead of 404 on top level
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http_errors.lua | 12 |
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); + |