Page 3 of 3

Re: "could not save:400 -- bad request -- ",only when I try to save templates

Posted: Mon Jun 02, 2008 11:39 am
by dscheff
Hi folks

I run on Plesk servers, and at some point either 8.1 or later, I started having these sorts of strange errors, some 500, some 400, and in several cases the fix was to put the following directive in the vhost.conf file:

SecRuleInheritance Off

Restart apache and voila!  It worked for me in this case, where the other suggestions were not helping.  Hope it helps someone else out there!

Re: "could not save:400 -- bad request -- ",only when I try to save templates

Posted: Tue Jun 03, 2008 8:01 pm
by jfverville
Hi everyone,

I have this error 400 too on template editing and I noticed some strange things:

- I get the 400 error even when I try to edit the template directly on phpmyadmin!

- I don't get the error all the time. If I only write {tags} for example, it will save correctly.

This works fine:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{sitename} - {title}</title>
{metadata}
{stylesheet}
{magpierss_in
but this doesn't work

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{sitename} - {title}</title>
{metadata}
{stylesheet}
{magpierss_inc
I really don't get it. Why just adding a "c" make a 400 error...

Anyway, hope this testing will help someone find out.

Jf

Re: "could not save:400 -- bad request -- ",only when I try to save templates

Posted: Tue Jun 03, 2008 9:22 pm
by alby
jfverville wrote: I have this error 400 too on template editing and I noticed some strange things:

- I get the 400 error even when I try to edit the template directly on phpmyadmin!

- I don't get the error all the time. If I only write {tags} for example, it will save correctly.
Check your server logs.
Probably you have error with mod_security

Alby

Re: "could not save:400 -- bad request -- ",only when I try to save templates

Posted: Wed Jun 04, 2008 1:27 am
by jfverville
Thanks for the advice. I found the server log. You are right, the errors seems to be about ModSecurity:

Code: Select all

[Tue Jun 03 16:00:05 2008] [error] [client 64.18.xx.xx] ModSecurity: Access denied with code 400 (phase 2). Pattern match "(?:\\bhttp\\/(?:0\\.9|1\\.[01])|<(?:html|meta)\\b)" at ARGS:content. [file "/etc/modsecurity2/modsecurity_crs_40_generic_attacks.conf"] [line "211"] [id "950911"] [msg "HTTP Response Splitting Attack"] [data "<__html"] [severity "ALERT"] [hostname "mydomainx.com"] [uri "/admin/edittemplate.php"] [unique_id "jvjKZNEsfNIAACmx0iEAAAAI"]

Code: Select all

[Tue Jun 03 16:00:05 2008] [error] [client 64.18.178.73] File does not exist: /home/mydomainx/domains/mydomainx.com/public_html/400.shtml, referer: http://mydomainx.ca/admin/edittemplate.php?template_id=29
Anything I can do to fix that?

Jf

Re: "could not save:400 -- bad request -- ",only when I try to save templates

Posted: Wed Jun 04, 2008 3:04 pm
by jfverville
Ok I sent an email to my hosting administrator and they fixed the problem. Thanks for all!

Jf