IP blacklist breaks site when using nginx reverse proxy to apache
-
Hi – I’ve got a few sites running on ServerPilot, and the software config there uses nginx as a reverse proxy in front of apache for increased performance. However, this causes AIOWPS to use incorrect syntax for the IP blacklist rules in the .htaccess file, instantly breaking the entire site every time this file is updated.
It looks like the root cause is the
AIOWPSecurity_Utility::get_server_type()
function which determines which syntax format to use for adding the blacklist rules. Since this function finds a string containingnginx
in$_SERVER['SERVER_SOFTWARE']
, that’s what AIOWPS uses for the syntax pattern. The problem is that this instantly bricks the site because apache can’t read the nginx format.I don’t see any particularly easy way to determine this type of server config from looking through the
$_SERVER
globals, but is there any way that you could add a filter in this function so we could manually override this value? It’s quite frustrating to have to manually edit .htaccess every time I change anything, and manually setting$_SERVER['SERVER_SOFTWARE'] = 'apache'
at the top of wp-config.php seems like a really hacky fix (though it does seem to work).
- The topic ‘IP blacklist breaks site when using nginx reverse proxy to apache’ is closed to new replies.