Because you haven’t used a second serverblock to house the SSL site’s configuration, the return 301 https://$server_name$request_uri; line redirects you to the SSL version of your site regardless of the scheme.

To rectify this, you can split the configuration into 2 server blocks, one for plaintext and another for SSL.