CHALLANGE: After configuring Sucuri Firewall, WordPress Media Upload Library displays the following error (when trying to upload big images): “Unexpected response from the server”.
SOLUTION: Increase SSL Buffer Size by adding the proper htaccess directive.
With so many threats in cyberspace, having an effective means of protection is a must. Sucuri Firewall is one way of making sure your website is secure. This highly effective cloud-based protective barrier shields websites against SQL injections, brute force attacks, DDoS and many other disruptive and potentially dangerous issues.
Despite being a trusted and reliable piece of software, a sucuri error might still occur. If you think you may have experienced a sucuri firewall error, have a look at the situation we describe below and follow our solution.
WordPress was working correctly. There wasn’t any issue with adding new files to WP Media Library. We’ve setup Sucuri Firewall (WAF) to protect the website from DDoS attacks and secure it.
Proper DNS records have been changed and Sucuri generated new SSL certificates (Let’s Encrypt).
After “the switch” we started to experience random wp-admin Errors (when uploading files). For 10 successful WP Media Library uploads – there were always 2-3 errors: “Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.”.
Error logs showed:
[Thu Jun 30 12:37:25.823135 2020] [error] [pid 13635] ssl_engine_io.c(1899): [client xx.xxx.xxx.x:51062] AH02018: request body exceeds maximum size (131072) for SSL buffer [Thu Jun 30 12:37:25.823159 2020] [error] [pid 13635] ssl_engine_kernel.c(850): [client xx.xxx.xxx.x:51062] AH02257: could not buffer message body to allow SSL renegotiation to proceed
It turns out that the SSL Buffer Size on the server is 128kb. So, if the request exceeds the size, the error will appear.
The solution was to add a proper htaccess directive into the .htaccess file:
# BEGIN fix for request body exceeds maximum size SSLRenegBufferSize 104857600 # END
More info: https://stackoverflow.com/questions/3718571/request-entity-too-large-php/
That’s it for today’s tutorial. Be sure to follow us for other useful; tips and guidelines.