Running behind nginx / different Port -> Login times out

Hi there,
Just updated to 4.0.2 on an apache server behind nginx proxy.

Nginx receives requests on port 443 and forwards them to apache on another port.

Since the update to 4.0.2, I received an alert when signing in to Matomo saying:
“You are accessing matomo from an unsecure host, please add to the trusted hosts”.
So in addition to adding to the trusted hosts, I ended up adding also to the trusted hosts in the config.

However, the login page times out when I try to login since the update. If I hit F5 after the timeout message from my browser, I see the 2FA Authentication page. I enter the 2FA code and hit login: Again timeout. Hitting F5 again finally leads me to the interface.

Did I miss something or is this a bug in the new version?

Thank you for your help.



This could maybe be related to

which is the only change I can think of that is related to the host check and port numbers.