mod_http: Fix http_external_url setting without an explicit port
authorKim Alvefur <zash@zash.se>
Wed, 26 Feb 2014 21:19:58 +0000 (22:19 +0100)
committerKim Alvefur <zash@zash.se>
Wed, 26 Feb 2014 21:19:58 +0000 (22:19 +0100)
plugins/mod_http.lua

index afcec06959a3f2fa1fa2de83a817cde949064df4..86689affdd12729cf036b0749928b95bbbdeadf8 100644 (file)
@@ -51,6 +51,9 @@ local ports_by_scheme = { http = 80, https = 443, };
 function moduleapi.http_url(module, app_name, default_path)
        app_name = app_name or (module.name:gsub("^http_", ""));
        local external_url = url_parse(module:get_option_string("http_external_url")) or {};
+       if external_url.scheme and external_url.port == nil then
+               external_url.port = ports_by_scheme[external_url.scheme];
+       end
        local services = portmanager.get_active_services();
        local http_services = services:get("https") or services:get("http") or {};
        for interface, ports in pairs(http_services) do