Error 502 Bad gateway.!

Testing outside of Cloudflare the origin server returns a 502 on both http and https. It may work for locally, perhaps you are located close to the orign server? But there are serious problems with that origin/ host/ network.

curl -I --resolve
HTTP/1.1 502 Bad Gateway
Server: nginx
Date: Wed, 23 May 2018 19:03:35 GMT
Content-Type: text/html
Content-Length: 166
Connection: keep-alive
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff

curl -Ik --resolve
HTTP/2 502
server: nginx
date: Wed, 23 May 2018 19:04:12 GMT
content-type: text/html
content-length: 166
x-xss-protection: 1; mode=block
x-content-type-options: nosniff