简体   繁体   中英

PHP Form POST redirects to 403 error page by LiteSpeed Web Server

The Web Server is LiteSpeed (looked up the phpinfo()).

A form is to be submitted with a textarea element.

When simple text is entered in the textarea, the form is submitted as expected.

But for some words, the 403 page is displayed (403 page by LiteSpeed). Eg. exit, exiting etc.

Any help is appreciated.

Got it working with -

in .htaccess file -

<IfModule mod_security.c> SecFilterScanPOST Off </IfModule>

This will tell the web server to just send the data across. Now as the security is lowered, simple steps should be taken while receiving the posted data.

  1. If any web framework is used, then accept the values similar to - $this->input->post('....'); or $this->request()->getPost('...'); , etc. And not just the simple $_POST['...'];
    This way the html filter is applied to the post data.

  2. If no web framework is used, then use addslashes('...') , strip_tags('...') , etc.

I hope this helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM