aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-05-24 14:43:45 +0200
committerKim Alvefur <zash@zash.se>2023-05-24 14:43:45 +0200
commit0b87371f786155ba7efd66489dc0aea0ae556e27 (patch)
treed27c8137d4981a4276ca3f42107d57996bb16a90 /plugins/mod_http.lua
parent2337f127b530e7d9ac61c408e7416fd54527c873 (diff)
downloadprosody-0b87371f786155ba7efd66489dc0aea0ae556e27.tar.gz
prosody-0b87371f786155ba7efd66489dc0aea0ae556e27.zip
mod_http: Add way to retrieve internal URL instead of external
This could be of help when configuring reverse proxies, as it is the internal URL the proxy must point at. Argument treated as an enum "internal" "external"(default) to allow for future extensibility.
Diffstat (limited to 'plugins/mod_http.lua')
-rw-r--r--plugins/mod_http.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index b50755df..f491a3f1 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -76,11 +76,11 @@ end
local ports_by_scheme = { http = 80, https = 443, };
-- Helper to deduce a module's external URL
-function moduleapi.http_url(module, app_name, default_path)
+function moduleapi.http_url(module, app_name, default_path, mode)
app_name = app_name or (module.name:gsub("^http_", ""));
local external_url = url_parse(module:get_option_string("http_external_url"));
- if external_url then
+ if external_url and mode ~= "internal" then
local url = {
scheme = external_url.scheme;
host = external_url.host;