ssl – Nginx listening on 80 after removing server block

I am trying to restrict http access to my webapp. It should only be accessed using https.

my nginx conf file looks like this:

server {
  listen                443 ssl;
  ssl_certificate       /home/ubuntu/certificate.crt;
  ssl_certificate_key   /home/ubuntu/private.key;

  server_name ec2-xx-xx-xx-xx.xx-xx-x.compute.amazonaws.com;
  
  # location blocks below ...
}

When I access my server using IP address and HTTP, it is redirecting users to https:// on chrome, but on firefox, it’s redirecting to https://. I want to disable redirect from HTTP to HTTPS. How do I do that?

Update: Clearing browser cache resolved this. Can I restrict access to my server using EC2 DNS? I only have SSL for my IP.