Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
10429:0b04d25c4ffb | 10430:46dd9df2db0c |
---|---|
73 if event.response then | 73 if event.response then |
74 event.response.headers.content_type = "text/html; charset=utf-8"; | 74 event.response.headers.content_type = "text/html; charset=utf-8"; |
75 end | 75 end |
76 return get_page(event.code, (show_private and event.private_message) or event.message); | 76 return get_page(event.code, (show_private and event.private_message) or event.message); |
77 end); | 77 end); |
78 | |
79 module:hook_object_event(server, "http-error", function (event) | |
80 local request, response = event.request, event.response; | |
81 if request and response and request.path == "/" and response.status_code == 404 then | |
82 response.headers.content_type = "text/html; charset=utf-8"; | |
83 return render(html, { | |
84 title = "Prosody is running!"; | |
85 message = "Welcome to the XMPP world!"; | |
86 }); | |
87 end | |
88 end, 1); | |
89 |