Software /
code /
prosody
Comparison
plugins/mod_http_errors.lua @ 11664:d83f8f44caea
mod_http_errors: Set status code 200 from root page
It isn't quite an error.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 09 Jul 2021 22:06:58 +0200 |
parent | 11663:04fa947784bc |
child | 11820:0375ef78ed64 |
comparison
equal
deleted
inserted
replaced
11663:04fa947784bc | 11664:d83f8f44caea |
---|---|
96 | 96 |
97 -- Something nicer shown instead of 404 at the root path, if nothing else handles this path | 97 -- Something nicer shown instead of 404 at the root path, if nothing else handles this path |
98 module:hook_object_event(server, "http-error", function (event) | 98 module:hook_object_event(server, "http-error", function (event) |
99 local request, response = event.request, event.response; | 99 local request, response = event.request, event.response; |
100 if request and response and request.path == "/" and response.status_code == 404 then | 100 if request and response and request.path == "/" and response.status_code == 404 then |
101 response.status_code = 200; | |
101 response.headers.content_type = "text/html; charset=utf-8"; | 102 response.headers.content_type = "text/html; charset=utf-8"; |
102 local message = messages["/"]; | 103 local message = messages["/"]; |
103 return render(html, { | 104 return render(html, { |
104 icon_raw = icon, | 105 icon_raw = icon, |
105 title = "Prosody is running!"; | 106 title = "Prosody is running!"; |