I have set up a nginx server with this config:
server {
server_name key.mydomain.fun;
location / {
proxy_pass http://mydomain.fun:6969;
}
}
server {
listen 80;
server_name admin.mydomain.fun;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name admin.mydomain.fun;
....
}
The strange thing is: When starting with a fresh browser and go to "key.mydomain.fun", I get a ssl cert warning that the cert is only valid for "mydomain.fun" and not "key.mydomain.fun". (I have a ssl cert configured for only mydomain.fun, so no wildcard).
After accepting I get to the key-page.
After that I want to access "admin.mydomain.fun" and get the error message again (Thats normal) and after accepting I get to my admin page.
Now the strange thing: when I now want to access "key.mydomain.fun" again, the admin site will be displayed. The URL is still "key.mydomain.fun" but I am at the admin page. After that "key.mydomain.fun" and "admin.mydomain.fun" will get me to the admin page.
When I now reset the browser (delete everything) I can redo those steps and access the "key.mydomain.fun" site again.
What went wrong here? Why do I see the admin page when going to "key.mydomain.fun"?