- Thread Author
- #1
Fixing the "Unexpected response from the server" Error in WordPress
Today, I encountered the message "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page." on a WordPress website. After extensive troubleshooting, I found the solution. Here's a step-by-step guide to resolve this issue effectively. The guide will work if you are on Apache2, Nginx and/or Cloudflare.
1. Check PHP Version and Settings
Create an info.php File
1. Create an
info.php
file inside the main website directory where you get the error using an editor of your choice:
Bash:
nvim info.php
2. Add the following content to the file:
PHP:
<?php phpinfo(); ?>
Verify PHP Settings
1. Check the values for:
- upload_max_filesize
- post_max_size
Make sure they are above the size of the file you are trying to upload.
2. Nginx Configuration
Edit Nginx Configuration File
1. Open the Nginx configuration file. Depending on your setup, use one of the following commands:
Bash:
sudo nano /etc/nginx/nginx.conf
or
Bash:
sudo nano /etc/nginx/sites-available/your-site-config
Add client_max_body_size Directive
2. Add the client_max_body_size directive within the http, server, or location block:
NGINX:
http {
...
client_max_body_size 10M;
...
}
or
NGINX:
server {
...
client_max_body_size 10M;
...
}
or
NGINX:
location / {
...
client_max_body_size 10M;
...
}
Reload Nginx
3. Save the file and reload Nginx:
Bash:
sudo systemctl reload nginx
3. Cloudflare Configuration
Cloudflare Upload Limitations
If you are using Cloudflare, there is a limitation on the upload size of the files. In the free plan, you aren't allowed to upload more than 100MB in a single request. Read more
.You must have 10 posts to see the links. Currently you had 0 posts.
Here are the upload limits per plan:
- 100MB Free and Pro
- 200MB Business
- 500MB Enterprise by default (
to request a limit increase)You must have 10 posts to see the links. Currently you had 0 posts.
Common Issues
- The problem is not just limited to WordPress and is independent of whether you are using Apache2 or Nginx.
- Uploading a file not using the drag-and-drop function in WordPress but using the standard upload function may result in the 413 Request Entity Too Large error.
Temporary Solutions
1. Cloudflare Origin Certificate: If you are using a Cloudflare Origin Certificate, you might want to install a local certificate with Let's Encrypt as a temporary solution.
2. Disable Orange Cloud: If you're not using a Cloudflare Origin Certificate, disable the "orange cloud" in your Cloudflare panel and click "Save".
This resolved "Unexpected response from the server" error for me and my WordPress site. Hopefully it works for your too. Let me know in the comments below.
Last edited by a moderator: