Same problem for me, happening in NGINX too.
This sounds like a bug where PHP is using the server provided hostname and port for redirection rather than the one requested by the client. It’s a pretty classic slip-up that I’ve made a few times myself.
This is new in 15.0.2, it didn’t happen in 15.0.0
Bug reported: https://github.com/nextcloud/server/issues/13713