Mod security - Having problems with mod security From Online Manual

Revision as of 21:44, 8 August 2013 by Irisado (talk | contribs)
Jump to: navigation, search

Some hosts have begun to install something called mod_security. This filters posts and URLs for certain key words and, if they are found, displays an error. Many people are experiencing problems, because of this. Problems include weird "403" or "Access denied" errors, login problems and similar.

For example, if one was to post this: Have you ever used cURL? You can find information about it at http://curl.haxx.se/. More specifically, libcurl is useful for accessing URLs in a program - it could be helpful if you're a programmer.

On a server with mod_security enabled, the poster would get an error. This error is unpreventable by SMF, because it's created by the server and Apache, before SMF even gets a say in anything.

However, depending on your host, it may be possible to disable this unnecessary and unwanted behavior. Since SMF is able to (properly) filter requests without resorting to blindly grasping at keywords, doing so should be completely safe. It is recommended that you talk to your host about having the mod_security filtering rules changed.

To try to disable it, you'll need a file called .htaccess. If you already have a file with that name, you'll want to open it with a decent text editor such as Notepad++, and add the above to it (top or bottom). Create a backup, though, before overwriting anything. If you do not already have one, create one. If your desktop PC won't allow you to edit a file called .htaccess, create the file with another name, such as .htaccess.txt. You can rename it after you load it up to the server. Put the following in the htaccess file:

<IfModule mod_security.c>
	# Turn off mod_security filtering.  SMF is a big boy, it does not need its hands held.
	SecFilterEngine Off

	# The below probably isn't needed, but better safe than sorry.
	SecFilterScanPOST Off
</IfModule>

Upload it to your server. If you used a different name, delete the .htaccess file on the server and rename the new file to .htaccess.

If your host does not allow you to disable mod_security, the forum will no longer load. Do not fret if this happens, just delete the .htaccess file or replace it with the backup you made earlier. If you need to do this, you cannot disable mod_security filtering. You can also ask your host if they can disable mod_security for you. If necessary, you can seek out a new host.



Advertisement: