Occasional HTTP 522 with self-hosted server
FIXED- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Other forums
- :
- Tech Help - Software/Hardware etc
- :
- Occasional HTTP 522 with self-hosted server
17-03-2022 1:18 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hello, at home I host a small webserver for private use on a Raspberry Pi. It serves a NodeJS-based application to play tabletop games. In the past I lived abroad (Bulgaria) and the same machine, with the same application, worked just fine under my previous ISP. However after I moved to the UK under PlusNet I started facing a number of HTTP 522 errors (connection timeout) when connecting to the server. The timeouts tend to go away after refreshing the page a couple of times, as the browser has time to build a local cache of the files it needs.
Now the server is proxied by Cloudflare, and I realize that a million things can be at fault for this problem, but I'm trying to troubleshoot exactly what it might be and I need to exclude any provider related issues. As far as I could gather:
- It's not a CloudFlare cache problem (I tried disabling the cache).
- It's not a CloudFlare firewall problem (I tried disabling the firewall).
- It's not a CloudFlare proxy problem (I tried disabling the proxy and pass straight my IP).
- In general CloudFlare seemed to route fine to my server when I was abroad.
- It's not a DNS problem (I have a dynamic DNS service running and verified that my IP is correctly updated when it changes).
- It's not a SafeGuard problem (I have SafeGuard disabled).
- It's not a router firewall problem (I tried disabling it).
- It's not a port forwarding problem (the application is reachable both outside and inside my home network).
- It's not an application or machine-related problem (the application works perfectly fine in my local network. Also the same machine and application worked in the past under a different ISP).
- It's not a browser problem (I tried with several different browsers: Edge, Chrome and Firefox. All face the 522 timeouts).
So I'm here asking, is there any chance there is something at the ISP level that is cutting my inbound connections short if they take too long? Or some specific configuration with inbound TCP keepalive messages?
Fixed! Go to the fix.
Re: Occasional HTTP 522 with self-hosted server
17-03-2022 1:26 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I forgot to mention, the 522 errors are not on the page, they are on single resources (mostly javascript files) served by the application. So the page loads but malfunctions. As I said, this tends to solve itself by refreshing a couple of times, as scripts that have been downloaded stay in cache and the missing ones are fetched again.
Re: Occasional HTTP 522 with self-hosted server
17-03-2022 2:22 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Moderators Note
This topic has been moved from Fibre to Tech Help
If it helped click the thumb
If it fixed it click 'This fixed my problem'
Re: Occasional HTTP 522 with self-hosted server
17-03-2022 4:07 PM - edited 17-03-2022 4:21 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@AlessioC wrote:
- It's not a CloudFlare cache problem (I tried disabling the cache).
- It's not a CloudFlare firewall problem (I tried disabling the firewall).
For how long? Note that caching can occur outside of cloudflare too, e.g. on the server or client/browser.
I would associate a 552 error with a proxying service or similar, specifically Cloudflare. I would not expect you to see 522 errors when going direct to your IP address/server.
From here...
"Like many other error pages on the world wide web, the 522 message is one of the HTTP status messages: while the preceding '5' indicates a server error, the following '2' indicates that the server error has occurred in conjunction with Cloudflare."
Edit: It doesn't particularly help but FWIW I have a small number of servers hosted behind Cloudflare proxies that are routed using dynamic DNS and I've never encountered a 522 error.
Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵
Re: Occasional HTTP 522 with self-hosted server
17-03-2022 4:15 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@bobpullen Could this be anything to do with Cloudflare's DDOS protection kicking in?
17-03-2022 4:19 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@AlessioC wrote:
I forgot to mention, the 522 errors are not on the page, they are on single resources (mostly javascript files) served by the application. So the page loads but malfunctions.
In the Network view of the browser debug console, there is probably a 'server' column that indicates the origin of the resources in question.
Maybe that offers some clues?
Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵
Re: Occasional HTTP 522 with self-hosted server
17-03-2022 4:21 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@Mook wrote:
@bobpullen Could this be anything to do with Cloudflare's DDOS protection kicking in?
In that instance, I'd expect a 4xx error (if anything).
Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵
Re: Occasional HTTP 522 with self-hosted server
17-03-2022 6:45 PM - edited 17-03-2022 6:46 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@bobpullen I did as you suggested, and the content is coming from Cloudflare.
After a bit more playing around I think the issue is entirely with Cloudflare. After realizing I could check the server I disabled Cloudflare's proxy, cleared the DNS cache and waited until I started getting responses directly from Nginx on my Raspberry. So fare I have reported 0 522 errors when the reply was coming from Nginx.
I think I was fooled by the DNS cache, I thought I was bypassing Cloudflare but it was still active. Thank you all for your assistance I will focus my investigation on Cloudflare.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Other forums
- :
- Tech Help - Software/Hardware etc
- :
- Occasional HTTP 522 with self-hosted server