I set up an Amazon Lightsail (Wordpress) server and I'm using CDN distributions with a custom domain and SSL certificate as described in this official article. All works well, and I'm able to access the site from the cloudfront distribution's HTTPS terminated endpoint (with the custom domain).
The problem is that I can still access the site directly via http and https on the server's static public IP address (which is the origin that cloudfront connects to). I went into Networking->IPv4 Firewall and disabled HTTPS because I read that cloudfront will only use http to connect to the origin. However I'm not sure if it will work if I disable http also, and I'm a bit puzzled by why Amazon never mentions this in the documentation. Are we supposed to leave the HTTP/HTTPS ports open in the firewall when serving lightsail through cloudfront, or should we limit it to cloudfront's proxy client's IP range? I know that in general leaving the proxied server open to public can cause (security) issues with certain code (or wp plugins) that expect always being called from behind a reverse proxy, as well as performance issues and possibly other issues if people, bots or hackers connect directly to the server instead of going through the CDN.