Magento – 403 forbidden error while POST content – Nexcess server

magento-1.9Security

I'm running Magento latest version on Nexcess server.

I have created custom module to store template design in database. I'm using PHP code within textarea like,

<div> First Name: <?php echo $order->getFirstname?></div>

I'm using form Post method. When trying to save data It's throwing 403 Forbidden error. However when i'm adding same content to the CMS Block, CMS Page and transactional emails, it's working fine.

Note: I have changed all file permission to 644 and folder permission
to 755 except var (777) and media (777).

Apache mod_security extension is enabled on server. But why different
behaviour between CMS page and my custom module.

Best Answer

You may have triggered some Mod Security rules with your custom module.

Try checking your Mod Security logs or disable it and see if it works.

If it's confirmed to be caused by Mod Security, you can either identify the particular rule and disable it or change your codes to workaround the rule.