Directly accessing server (by IP) works fine but accessing through Cloudflare sometimes timeouts

When I go to my site Nginx site serving static file by entering its IP, everything works fine
and I get a response in a few milliseconds.
However, if I access the site by using its domain (protected by Cloudflare), it usually works fine but sometimes (every 5-10 requests) it gives a 524 timeout. I also got 522 and 525 errors a few times. Sometimes, a request completes in about a minute.

For more than a year, it was working and I don’t recall changing anything.

Config:

server {
    listen 80 default_server;
    listen 443 default_server ssl;
    server_name domain.name;
    ssl_certificate /path/key.pem;
    ssl_certificate_key /path/key.key;

    gzip off;
    proxy_max_temp_file_size 0;

    location / {
            root /path/build/;
            try_files $uri $uri/ /index.html;
    }
 }

Any ideas what could cause this?

I’ve tried both enabling and disabling Development Mode but it doesn’t change anything.

Update: the problem seems to be gone. I haven’t changed anything on my server. ISP didn’t report any outages. However, everything seems to be working as it should.
However, it would still be great to hear any ideas on what could have caused this.

Is your host/origin server networking configuration allowing the Cloudflare IP addresses to connect to it?

Are your DNS A www and A yourdomain (or if using CNAME?) records :orange: or :grey: at your Cloudflare dashboard?

Have you checked your firewall and network configuration?

Due to 5xx errors you are experiencing:

That is kind a strange one. But, does it mean you have been using Cloudflare for your domain already for a year and now this happens?

Hi, thanks for the reply!

I tried traceroute for a few different Cloudflare IPs and they succeded. Most of the time I’m getting 524 so that should mean that connection was established, shouldn’t it?
I’m using :orange: A records.

Yes, I was using Cloudflare for a year and everything was working. I might have experienced 524 a few times before but only for individual requests.

I just deployed my app to use IP everywhere and I don’t experience any issues (no Cloudflare protection though). Accessing the site through Cloudflare still often fails.

I also tried Off and Flexible SSL/TLS encryption modes, but no success.

Have you treid pausing Cloudflare or turning :orange: records to :grey:?
Does that way anything change?

Interesting. Could it be an issue at the host/origin server then?

What kind of an issue could it be with the origin server if accessing it directly works fine (even with a self-signed SSL certificate)?

Update: the problem seems to be gone. I haven’t changed anything on my server. ISP didn’t report any outages. However, everything seems to be working as it should.
However, it would still be great to hear any ideas on what could have caused this.

To be clear: I’m hosting the server myself. I would know about any software changes.

This topic was automatically closed after 31 days. New replies are no longer allowed.