Error 502 Bad gateway.!


#1

Suddenly my website showing this (Error 502 Bad gateway) error. Screenshot is attached I checked DNS setting and all is correct. Please help to get out of this.


#2

There is a problem with your origin server. You’ll need to contact your hosting provider or correct it. https://support.cloudflare.com/hc/en-us/articles/218378978-What-should-I-do-after-seeing-a-502-or-504-gateway-error-on-my-site-

curl -Ik --resolve hubtitle.com:443:your.origin.ip.address https://hubtitle.com
HTTP/2 502
server: nginx
date: Wed, 16 May 2018 20:43:18 GMT
content-type: text/html
content-length: 166
x-xss-protection: 1; mode=block
x-content-type-options: nosniff


#3

I already contact with my Hosting provider and they give me the following link and told me

"Please check the attached file. Your A record IP will be 64.188.2.209 , But http://leafdns.com/index.cgi?testid=6D62130F here we see its not matched. So please contact with your SSL certificate provider Cloudflare. "

Please help to get out of this.


#4

They’re not familiar with Cloudflare’s proxy service. Those IP addresses are correct.

Please double-check your DNS settings here at Cloudflare to make sure that your domain’s A records use the same 64.xxx IP addresses from your post.

I tested the Curl command @cscharff suggested and your server responds with “SSL certificate problem: certificate has expired”

You need to fix the certificate at your web host.


#5

I checked my host A record and its perfectly ok. 64.xxx IP addresses. I can’t understand where is the problem.


#6

Contact them again. Provide the information below to them. They can substitute the 64. address themselves in the curl command and verify their server is responding with a 502 error. Or you can set the entry to :grey: so the IP will show up as 64. to ease their minds (and the problem will still be on their origin) and after needlessly exposing your origin IP you can then change the record back to :orange: once they fix the problem which exists squarely at the origin.

curl -Ik --resolve hubtitle.com:443:your.origin.ip.address https://hubtitle.com

HTTP/2 502
server: nginx
date: Wed, 16 May 2018 20:43:18 GMT
content-type: text/html
content-length: 166
x-xss-protection: 1; mode=block
x-content-type-options: nosniff

#7

Does an expired certificate trigger a 502?


#8

No, the cert has been expired for months. There’s a problem with the origin server itself. They’ve now changes something as https://hubtitle.com now responds with a 301 to https://www.hubtitle.com. But, then the origin server responds with a 502 (again/still).

If they look at the curl command above, run it and still say everything is “fine” then it’s time to ask them to escalate to someone who knows how to spell curl.


#9

When I removed the cloudflare totally, website works fine. This error come from cloudflare. I observed that Cloudflare is not free. It has limitation on free plan.


#10

The problem is not with Cloudflare. At this point you have the naked domain pointing at Cloudflare (but apparently entered an invalid IP address on their end) and the www host to your actual server. If you open https://www.hubtitle.com you will notice the certificate warning, mentioning that it is a certificate for eicra.com and not your domain.


#11

Define works fine…

The issue is at the origin. The information I provided for troubleshooting should be sufficient for your web host to resolve the issue. If they can’t… you could set your SSL to flexible, which uses http instead of https to connect to your origin. That will ‘fix’ the problem by not using SSL to connect to your origin, but SSL on your origin is still broken.


#12

At this point the entire site is off of Cloudflare (well, except for the nameservers).

Considering the site does have a TLS endpoint, wouldnt “Full SSL” (not strict) still be better?


#13

You could give Full (not strict) a try, but that screenshot reminds me of what cPanel does when your site doesn’t support SSL. It’s as if cPanel won’t even let you in on Port 443.


#14

I guess that depends on the end goal. Switching to full strict will change from the original 502 error to a 525 error.


#15

I am speaking here purely from a TLS point of view. Whatever happens beyond TLS is certainly a different subject and it appears it would require some tweaking there as well, but I’d except him to be able to at least go through to his webserver if he sets it to “Full SSL”.

Why a handshake error? The certificate appears to be valid, it simply has been issued for a different host and case is one of those was “Full SSL” was designed for, wasnt it?


#16

It appears your hosting provider has finally fixed the origin server to display your website on port 443. You should now be able to enable Cloudflare again.


#17

It still seems to present the same certificate from two days ago.


#18

But it neither returns a 502 error nor does it return a generic webserver page. So with the customer’s previous settings changing the DNS record back to :orange: will allow the site to be rendered via Cloudflare.


#19

True, they finally managed to have it point to the right directory. Though the certificate is still misconfigured and should be fixed.


#20

But when I change back to :orange: my dns its again goes to the first stage “Error 502 Bad Gateway from Cloudflare.”