Redirecting without canonicalizing the port

Can I redirect to a URL that uses the port number in the request, as
opposed to the port specified in listen? (so as to work with
proxies/tunnels)

E.g., if I have listen 444 and have a tunnel so that my client is
surfing http://localhost:4444, I don’t want my redirects to send the
client to http://localhost:444, which is currently the case - I want
the port number to be reflected back, not “canonicalized.”

Thanks in advance for any hints.

This seems to happen for all redirects (e.g. rewrites), but if it
makes any difference, the particular redirect I’m interested in is
from

location /foo { alias /…/foo; }

Requests to /foo get redirected to /foo/ (but with the wrong port
number, as described below).