|

XML-RPC Problem in WordPress and Blog Clients

Having problems using your blog client with WordPress? I have been getting errors for awhile without being able to post to WordPress using a blogging software.

I was lucky enough to be able to get the following error messages: “XML-RPC server accepts POST requests only.” or “The server returned an unexpected reponse code: 403” or “Wrong content-type”. Not exactly stellar but it allowed me to find a solution to this problem on the Internet.

They narrowed the problem down to a rather technical detail. There is a configuration problem on the host because the host is behaving drastically differently depending on the “Content-Type” of the request.

The problem arises because when a remote editor connects to a WordPress installation, it communicates with HTTP POST requests. In every case the contents of the HTTP messages are XML data, so the “Content-Type: text/xml” header is passed along with the request.  But the server seems committed to only returning the expected value if the Content-Type is set to “application/x-www-form-urlencoded”, a typical value for *forms* that are posted, e.g. from a web page.

There’s nothing that can done from the client to alleviate this. The server has to be accommodating of “Content-Type: text/xml” requests. In many cases this restriction is because the hosting service has enabled mod_security Apache module with all the guards up.

The following workaround works for me:

  1. Create a .htaccess file.
  2. Add the following:

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

  3. Save and upload the .htaccess file to the directory with the WordPress files.

You can read the original discussion of this issue at Red Sweater Software forums.

On a particular note: HostingRails customer support staff have been really helpful in diagnosing and solving all of my problems while using their service. Two-thumbs up for these guys! 🙂

Technorati Tags: , , , , , , , , , , ,

Similar Posts