Score:0

Unable to access web server via Cloudflare after configuring EC2 security groups

gd flag

I have an EC2 instance running a web server (NGINX), and I'm trying to set up authentication via Cloudflare. Here's what I've done:

  1. Added a security group to the EC2 instances with an inbound rule allowing all traffic (all protocols and ports) from our office IP address. This was so that I can communicate with the server.
  2. Added another security group with several inbound rules to the allowing inbound HTTP traffic from all Cloudflare IP addresses (https://www.cloudflare.com/en-gb/ips/).

With this configuration, I can access the website using the EC2 instance's IP address, but not the domain name.

To troubleshoot, I modified the rules of the second separate security group associated with the EC2 instance (2nd step above). I allowed inbound traffic for all protocols from Cloudflare IPs and now I can reach the server but I encounter an error in my browser:

ai.example.com normally uses encryption to protect your information. When Chrome tried to connect to ai.example.com this time, the website sent back unusual and incorrect credentials. This may happen when an attacker is trying to pretend to be ai.example.com or a Wi-Fi sign-in screen has interrupted the connection. Your information is still secure because Chrome stopped the connection before any data was exchanged.

You cannot visit ai.example.com right now because the website uses HSTS. Network errors and attacks are usually temporary, so this page will probably work later.

I'm unsure why I'm experiencing these issues. Could someone please help me understand what might be causing this problem and how I can resolve it? I want to ensure proper authentication via Cloudflare while being able to access the web server using the domain name.

Tim avatar
gp flag
Tim
I have this working fine, it's your configuration, so we need more detail to help. You've said you're trying to do authentication via CloudFlare - do you mean you're trying to do DNS and CDN or do you really mean auth? What settings have you configured for Cloudflare's connection to the web server - http, strict https, etc? What ports is your server listening on? Is iptables configured? Have you added cf ipv4 and ipv6 addresses? Does your server support ipv6? Please answer these questions and provide screenshots of config (e.g. sg rules) in your question, don't answer in comments
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.