When running on a non-standard port, and behind a load balancer/proxy, it has become "standard" to forward along a header called
This header is very similar to
X-Forwarded-For in the sense that it's forwarding relevent information about the originating request and telling your backend to ignore the values it's aware of.
In this case,
X-Forwarded-Port is not supported by Django natively, and the easiest way to handle it is through a simple middleware:
This will allow urls to be properly reversed with the correct port as you'd expect.