- Mais recentes
- Mais votos
- Mais comentários
The 521 error code that you're encountering is a HTTP status message from Cloudflare that means the web server refused the connection. Given that you're receiving a 521 error, it's likely that your EC2 instance isn't accepting incoming connections from Cloudflare.
Ensure that your web server (Apache, Nginx, etc.) is set up to accept requests for your domain name, the same one you set in Cloudflare.
Verify your Security Group settings: Confirm that your AWS security groups permit HTTP (port 80) and HTTPS (port 443) traffic from all of Cloudflare's IP ranges. Cloudflare proxies your traffic, which means to your server it appears as if the traffic is coming from Cloudflare.
Check your VPC Network ACLs: AWS Network Access Control Lists (ACLs) can also control the flow of traffic at the subnet level. Make sure that the ACLs associated with your EC2's subnet are allowing inbound and outbound traffic on ports 80 and 443 from Cloudflare's IP ranges.
You can find a list of Cloudflare's IP ranges here: https://www.cloudflare.com/ips/
Yes the web-server must have HTTPS enabled, configured an have the correct certificate installed.
I enable https, and I can access both http://{my ip}index.html and https://{my ip}/index.html, and also https://{my domain name}/index.html, but I can't access https://{my ip}/login, I think the issue will be solve soon
Hi, after I enable https and reset WSGI, I solved this problem, thank you for your help
Make sure that your DNS settings in Cloudflare are set up correctly: Cloudflare should be directed towards the public IP or Elastic IP of your EC2 instance. This means that there needs to be an "A" record that references your EC2 instance's public IP address. It's crucial that this record is configured to be proxied, indicated by an orange cloud.
Yes, I'm sure that's correct
Ok interesting, a few questions. Did you check the VPC's Network ACL's for allowing both Inbound and Outbound traffic? How about making sure the DNS name resolves to the correct IP? Same errors when accessing the webserver over 80? 443? Do you have any Cloudflare WAF rules enabled?
Hi, I upload my setting of security group and Network ACL
How about making sure the DNS name resolves to the correct IP? And do you get the same exact error when accessing the webserver over 80 and 443?
I copy the IP from my ec2 instance, and copy it to cloudflare, so I think it's correct. I guess I just get the same error on port 443, port 80 is ok to access
You can access over 80 ok, but when using 443 you get a 521 Error?
I can access http://{my ip}, https://{my ip} shows ERR_CONNECTION_REFUSED. but cloudflare redirect http to https, so I guess aws block cloudflare in somewhere
Sounds like a certificate problem or web-server/application problem, rather than an AWS problem. 521 error means the web server actively refused the connection, so the request made it to the EC2 instance, proving that network path is good and EC2 is reachable.
Check your web server and certificate configuration to ensure it is properly set up to handle HTTPS requests.
You can also check your Cloudflare SSL/TLS Settings: Double-check your SSL/TLS settings in the Cloudflare dashboard. Ensure that you have the correct encryption mode selected (e.g., Full, Full (Strict), Flexible) and that the SSL/TLS configuration matches the settings on your web server.
If it's a certificate problem, then it will show error 526. I've set all encryption mode in Cloudflare, and get the same error code. and when I try telnet {my IP} 443, it shows "Unable to connect to remote host: Connection refused". My server just use http now, I'll try to use https.
I Allow all traffic, ports and protocols, and I don't have any Cloudflare WAF rules How do I make sure the DNS name resolves to the correct IP
Conteúdo relevante
- AWS OFICIALAtualizada há um ano
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há 3 meses
- AWS OFICIALAtualizada há 4 meses
I allow all traffic in and out for all ip in port 80 and 443, it doesn't work