Software / code / prosody
Comparison
plugins/mod_http.lua @ 12269:a19d435dee90
mod_http: Use interface name as default default global hostname
http://[::]:5280/ is as sensible as http://*:5280/ so why not
This might be a bit weird when listening no multiple interfaces but not
sure we can really do anything sensible then anyway.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 04 Feb 2022 20:11:18 +0100 |
| parent | 12268:d41e8c7890b0 |
| child | 12443:17d87fb2312a |
comparison
equal
deleted
inserted
replaced
| 12268:d41e8c7890b0 | 12269:a19d435dee90 |
|---|---|
| 93 for interface, ports in pairs(http_services) do -- luacheck: ignore 213/interface | 93 for interface, ports in pairs(http_services) do -- luacheck: ignore 213/interface |
| 94 for port, service in pairs(ports) do -- luacheck: ignore 512 | 94 for port, service in pairs(ports) do -- luacheck: ignore 512 |
| 95 local url = { | 95 local url = { |
| 96 scheme = service[1].service.name; | 96 scheme = service[1].service.name; |
| 97 host = module:get_option_string("http_host", module.global | 97 host = module:get_option_string("http_host", module.global |
| 98 and module:get_option_string("http_default_host") or module.host); | 98 and module:get_option_string("http_default_host", interface) or module.host); |
| 99 port = port; | 99 port = port; |
| 100 path = get_base_path(module, app_name, default_path or "/" .. app_name); | 100 path = get_base_path(module, app_name, default_path or "/" .. app_name); |
| 101 } | 101 } |
| 102 if ports_by_scheme[url.scheme] == url.port then url.port = nil end | 102 if ports_by_scheme[url.scheme] == url.port then url.port = nil end |
| 103 return url_build(url); | 103 return url_build(url); |