Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Ok, this is seriously weird and I have no clue what's going on here. I am using WordPress 3.0.1, I create a new blog post, give it a title, paste the following code into the blog post and hits Save Draft.

<code lang="php">
// Init curl
$request = curl_init();

// Set request options
curl_setopt_array($request, array
(
    CURLOPT_URL => 'https://www.sandbox.paypal.com/cgi-bin/webscr',
    CURLOPT_POST => TRUE,
    CURLOPT_POSTFIELDS => http_build_query(array
        (
            'cmd' => '_notify-synch',
            'tx' => $_GET['tx'],
            'at' => $your_pdt_identity_token,
        )),
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_HEADER => FALSE,
    CURLOPT_SSL_VERIFYPEER => TRUE,
    CURLOPT_CAINFO => 'cacert.pem',
));

// Execute and get the response and status code
$response = curl_exec($request);
$status   = curl_getinfo($request, CURLINFO_HTTP_CODE);

// Close
curl_close($request);
</code>

Just a code example in my head, but seems like WordPress thinks otherwise, cause when I hit Save Draft, Preview or Publish all I get is a blank page with the following text:

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

What in the world is going on here??

share|improve this question

migrated from webapps.stackexchange.com Jun 14 '11 at 4:54

This question came from our site for power users of web applications.

1 Answer 1

up vote 1 down vote accepted

And of course after I ask the question, I find the solution... Apparently it's caused by a trigger happy Mod_Security.

Adding these lines to the .htaccess file makes it go away nicely:

<IfModule mod_security.c>
  SetEnvIfNoCase Request_URI ^/wp-admin/(?:post|async-upload)\.php$ MODSEC_ENABLE=Off
  SetEnvIfNoCase Request_URI ^/xmlrpc\.php$ MODSEC_ENABLE=Off
  SecFilterDebugLevel 0
  SecFilterDefaultAction "deny,nolog,noauditlog,status:503"
</IfModule>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.