There is such a website. The login interface is domain name A. After successful login, it will jump to another domain name B.
If you directly access the B domain name, it will jump to the A domain name without logging in. If you have already logged in, you are still in domain name B.
It is recommended not to use Nginx configuration, it will be better to implement it on the front end
Use business code to implement it to determine whether you are logged in. If you are not logged in, initiate a redirect. It is a very mature solution.