Software /
code /
prosody
Diff
plugins/mod_http_errors.lua @ 10430:46dd9df2db0c
mod_http_errors: Show a friendly page instead of 404 on top level
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 17 Nov 2019 16:16:53 +0100 |
parent | 9760:88640b3ea6b8 |
child | 10574:f70c874b7936 |
line wrap: on
line diff
--- a/plugins/mod_http_errors.lua Sat Nov 23 17:15:34 2019 +0100 +++ b/plugins/mod_http_errors.lua Sun Nov 17 16:16:53 2019 +0100 @@ -75,3 +75,15 @@ 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); +