Permanent redirecting alias domain + web_port != 80 == problems

1 post / 0 new
#1 Thu, 05/08/2014 - 14:13
pcg

Permanent redirecting alias domain + web_port != 80 == problems

Greetings,

I am running some domains (managed by Vmin) on port 81 with nginx (unmanaged by Vmin) sitting on port 80 and proxying back to Apache/port 81. I would like to create an alias domain that does a RedirectPermanent (e.g., from example.org to example.com). However, based on the code in feature-web.pl (around lines 88ff) the port is included in the redirect line. The result is something like:

RedirectPermanent / http://www.example.com:81/

That is undesirable for various reasons... I know I can skin this cat other ways, but none so easy as simply creating an alias domain. (That is, I don't want to tell my clients to start adding rewrite rules, or even that they have to pull down a different template from the dropdown at virtual server creation time, especially since this is so close.) Looking at my config, my domain has web_urlport set to 80, so I'm wondering if I can use that setting in feature-web.pl to correctly (in this case) omit the port, like:

local $portnum = $aliasdom->{'web_urlport'} || $aliasdom->{'web_port'};
local $port = $portnum == 80 ? "" : ":$portnum";

If I'm understanding that correctly, it would first consult the parent domain's web_urlport, which, if present, SHOULD be the port used in the target of the redirect, eh? Failing that, it will continue to check web_port.

Is this a reasonable enhancement to make permanent redirecting domains work a little better with non-standard ports? Or have I totally missed the point of things, e.g., web_urlport?

Thanks, Peter