Error 502 when traffic routed through the Cloudflare system


#1

I am wondering when I am routed my traffic through cloudflare system its showing port 80 is closed.


#2

Can you rephrase your question?


#3

I have create a new EC2 instance at AWS. It’s supposed to be a wordpress server & nginx is up & running. My domain is registered under Godaddy & after installing nginx the defult nagix welcome page is coming but the problem arise when I am change my nameserver to cloudflare, now its showing Error 502 Bad gateway. I am very new so I think I may do some silly mistake. Can you please help on this matter.


#4

Check if that helps


#5

Tnx for sharing but if my server (AWS EC2) not configured properly then how its working when Godaddy nameserver is in use, that’s why im not able to understand as previously I assume like I do something wrong with the EC2 security group but I double check this.


#7

EC2 has their own firewall (security groups) in front of their server instances https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html.

Did you make sure to whitelist http (port 80) and https (port 443) at EC2 Firewall level ? And also ensure your EC2 server is properly recording real visitor’s IP addresses https://support.cloudflare.com/hc/en-us/sections/200805497-Restoring-Visitor-IPs ?

You may also need to whitelist Cloudflare IPs https://www.cloudflare.com/ips/ at EC2 firewall level


#8

my website url : http://urbnwp.com/

AWS security group setting inbound setting


#9

So url domain works with cloudflare disabled on non-https version of domain ?

curl check your url gives HTTP/1.1 521 Origin Down see troubleshooting steps at https://support.cloudflare.com/hc/en-us/articles/200171916-Error-521-Web-server-is-down.

have you verified that nginx sees real visitor ips and not cloudflare’s ip ? check nginx logs for more clues as well


#10

Tnx problem solve my nginx is not recording real visitor IP.