Troubleshooting and Fixing FTP Connection Error When Using Cloudflare
Quick Summary of Contents
I received an email the other day from a customer that’s been us nearly 15 years.
About a year or so ago, we served this customer by upgrading their website design and hosting as well as implementing SEO retainer services.
Most recently, in an effort to speed up and optimize website performance, we implemented the use of Cloudflare for the customer’s website hosted via Bluehost.
If you haven’t heard of or not using Cloudflare, then you are missing out on realizing greater website performance and increased boost search rankings.
I originally discovered Cloudflare and all of it’s goodness from SEO Legend Bill Hartzer while attending DNHouston some time ago.
The reason I mention Cloudflare is because this is where my mind immediately was drawn to when receiving the customer’s email about not being able to successfully File Transfer Protocol (FTP) to the web server.
FTP Connection to web server via IP Address
Now, it’s not impossible to use FTP with CloudFlare, but connecting via FTP to a domain protected by Cloudflare will not work. Cloudflare only proxies web traffic going through specific ports, excluding standard FTP ports.
Before I dived into the technical weeds of FTP, I ensured that the customer had the proper credentials and settings in Filezilla per Bluehost online instructions.
Unfortunately, the following error existed via Filezilla’s status pane:
// FTP Transfer Details Pane Status: Connecting to 1.2.3.4:21... Status: Connection established, waiting for welcome message... Status: Logged in Status: Retrieving directory listing... Command: PWD Response: 257 "/" is your current location Command: TYPE I Response: 200 TYPE is now 8-bit binary Command: PASV Response: 227 Entering Passive Mode (1,2,3,4,186,71) Command: MLSD Error: Connection timed out after 20 seconds of inactivity Error: Failed to retrieve directory listing
So, I had the customer take a few actions in efforts of discovering a viable FTP solution.
Create Grey-Clouded DNS Record for FTP
Although not the safest method because of bypassing Cloudflare protection at the DNS level, I had the customer simply create a DNS record (preferably an A Record, although CNAME record could work too) for FTP that has Cloudflare turned off.
I don’t recommend this step as a solution because it could open a website to experience cyber attacks. Because this configuration bypasses Cloudflare’s protection, attackers can easily find your web server’s IP address.
So, try this step at your own expense of compromised security. We unsuccessfully attempted this step and still encountered the error mentioned in the previous section.
What now? 🤔
Could it be the Connection Timeout Setting in Filezilla?
After a few back and forth of “try this, try that” fix attempts, it finally occurred to me to venture into Filezilla’s Connection settings (i.e., Edit > Settings).
There I found in the Timeout section of Connection settings, the Timeout in seconds value was 20.
Deciding to experiment, I changed the value to 60 and still encountered an error message.
// FTP Transfer Details Pane Status: Connecting to 1.2.3.4:21... Status: Connection established, waiting for welcome message... Status: Logged in Status: Retrieving directory listing... Error: Connection timed out after 60 seconds of inactivity Error: Failed to retrieve directory listing
Then I arbitrarily decided to set Timeout in seconds value to 100 (and would have worked my way to 300 seconds – equivalent to 5 minutes).
And what do you know!? SUCCESS! 👏 We were able to successfully login, finally. 🤗
// FTP Transfer Details Pane Status: Connecting to 1.2.3.4:21... Status: Connection established, waiting for welcome message... Status: Logged in Status: Retrieving directory listing... Status: Directory listing of "/" successful
Final Thoughts on Fixing Bluehost FTP Connection Error When Using Cloudflare
Although only a few actions are mentioned in this article, there are a myriad of actions to consider when attempting to troubleshoot and fix Bluehost FTP connection error when using Cloudflare.
First things first, be certain to check and validate FTP settings BEFORE attempting any of these fixes, or you’ll likely introduce more errors and greater levels of troubleshooting complexity.
Should changing or setting Timeout in seconds value to 100 not allow for successful FTP login, the I suggest increasing it by increments of 20 until it does work.
And although this article is focused on Bluehost FTP in conjunction to Cloudflare, troubleshooting actions are likely to work across other major web hosting providers.
That’s all for now! Please do leave questions and comments below should you have any, or encounter any other technical challenges.