Weird redirection question

Hi everybody!

I'm trying to determine if I'm doing something wrong or it's normal behavior. I have the site aaa.fi which redirects to https: // www.bbb.fi, meaning from HTTP to HTTPS. The certificate is for the website bbb.fi. That works well.

However, if I type https: // aaa.fi -> browser (chrome) tells me that the connection is not secure and that it does not redirect to the https: // www.bbb site. fi, which should be the case.

I hope that I managed to explain this in an understandable way. So, could someone more experienced tell me if it is the expected behavior or if my configuration is incorrect?

Here is the site configuration file (hidden for security reasons):

server {
listen to 80;
server_name bbb.fi;
access_log /PATH/aaa.fi.access.log combined;
returns 301 https: // www. aaa.fi $ request_uri;
}

server {
listen to 80;
server_name www. bbb.fi;
access_log /PATH/aaa.fi.access.log combined;
returns 301 https: // www. aaa.fi $ request_uri;
}

server {
listen to 443;
server_name bbb.fi www. bbb.fi;
SEMrush

shared ssl_session_cache: SSL: 10m;
ssl_session_timeout 60m;

ssl_certificate / PATH;
ssl_certificate_key / PATH;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

ssl_prefer_server_ciphers on;
ssl_ciphers ECDH + AESGCM: ECDH + AES256: ECDH + AES128:REH + 3DES :! ADH :! AECDH :! MD5;

ssl_dhparam / PATH;

add_header Strict-Transport-Security "max-age = 31536000" always;

ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /PATH.crt;
resolver 213.140.164.26 212.149.120.42;

access_log /PATH/aaa.fi.access.log combined;
returns 301 https: // www. aaa.fi $ request_uri;
}

Sorry for the spaces between the URLs. Looks like the forum does not accept my post with obscured addresses.