this seems to be a bug when using alternative ports.
I have an environment where I set the port to 8765.
So calling the url http://localhost:8765/dd
works fine and gets me to the login screen. After entering the credentials I get an redirect error.
After looking into the issue I see that in the function application_url (in admin/incFunctions)
the creation of the url is put together wrong.
I have in my environment the $_SERVER as:
[HTTP_HOST] => localhost:8765
[SERVER_NAME] => localhost
[SERVER_ADDR] => ::1
[SERVER_PORT] => 8765
[REMOTE_ADDR] => ::1
The function is creating out of this information the url:
this happens to my opinion because the HTTP_HOST is used to create the URL, by appending the port. But the port is already there.
$host = (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : $s['SERVER_NAME']) . $port;
adds the port to the already exising port extension.
Please have a look at this.