We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27622
    • 17 Posts
    I’m using MODx for a while and since some time (don’t know exactly because i didn’t change much for a long time) when trying to change content or templates, the server troughs a bad request error (400) when saving (so de file doesn’t get saved).

    used MODx 1.02 and got this error but just tried 2.0.0-rc-2 rev6923 and got the same problem... the following is the request done by 2.0.

    POST /modx2/connectors/element/template.php HTTP/1.1
    Host: www.mysite.com
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; nl; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: nl,en-us;q=0.7,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Connection: keep-alive
    X-Requested-With: XMLHttpRequest
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8
    Referer: http://www.mysite.com/modx2/manager/index.php?a=19&id=1
    Content-Length: 395
    Cookie: PHPSESSID=rml3ifb3atq3830v7p8cphan47; __utma=188823214.738457127.1274362477.1277217043.1277824361.12; __utmz=188823214.1274362477.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); ys-modx-leftbar-state=o%3AactiveTab%3Dn%253A1; ys-modx-element-tree=s%3A/root/n_type_template/n_template_element_1_0; ys-modx-gr-tree-resource=s%3A/0/web_0; ys-modx-resource-tree=s%3A/root/web_0/web_1; SN4b0a9c630fa4d=ndmhdkibqovi6je9t5a46fj2p0; PHPSESSID=5n7llchlqr5nfa73ltss3sotd4; webfxtab_childPane=0; webfxtab_settingsPane=4; webfxtab_resourcesPane=0; __utmc=188823214; ys-modx.stay.19=s%3Aclose
    Pragma: no-cache
    Cache-Control: no-cache
    
    action=update&id=1&modx-ab-stay=&tvs=%7B%7D&propdata=%5B%5D&id=1&props=&templatename=test2&description=Template&category=&clearCache=1&content=%3Chtml%3E%0A%3Chead%3E%0A%3Ctitle%3E%5B%5B%2B%2Bsite_name%5D%5D%20-%20%5B%5B*pagetitle%5D%5D%3C%2Ftitle%3E%0A%3Cbase%20href%3D%22%5B%5B%2B%2Bsite_url%5D%5D%22%20%2F%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%5B%5B*content%5D%5D%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E


    response:
    HTTP/1.1 400 Bad Request
    Date: Wed, 30 Jun 2010 01:29:18 GMT
    Server: Apache/2.2.0 (Fedora)
    Content-Length: 314
    Connection: close
    Content-Type: text/html; charset=iso-8859-1


    I don’t get this error when my document contains only simple text but as soon as using some tegs like html body or something it doesn’t get saved...

    I suspect this to be a problem of my hostingprovider but i want to be sure modx doesn’t make a mistake before contacting them.

    So does anybody see anything strange about this request of should it just work fine and do you confirm my suspicion?

    grtz SlechtValk
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Sounds like they’ve enabled some kind of security on the server. http://wiki.modxcms.com/index.php/What_is_mod_security_and_how_does_it_affect_me
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 27622
        • 17 Posts
        Quote from: sottwell at Jun 30, 2010, 06:01 AM

        Sounds like they’ve enabled some kind of security on the server. http://wiki.modxcms.com/index.php/What_is_mod_security_and_how_does_it_affect_me

        This sounds plausible, and i found "mod_security2" in "Loaded Modules" but al mentioned changes in .htaccess result in Internal Server Error (500)... is it possible i should use another switch for mod_security2?
          • 27622
          • 17 Posts
          I tested a little bit more and found out that the following code does trigger the 400...:
          <a href="http://test.com">test</a>
          <a href="http://test.com">test</a>
          <a href="http://test.com">test</a>
          <a href="http://test.com">test</a>

          just four simple links... removing one and the problem is solved

          and testing on... the following even simpler code does trigger it...:
          http://
          http://
          http://
          http://

          could it be some faulty regular expression in blocked strings or something like that?
          or some way of my hosting provider to reduce spam... assuming that post data with more than 3 links could only be spam? :S

          edit: removing one "http://" results in faultless transmission...
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Sounds like you need to have a little talk with your hosting provider.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org