Lighttpd and JetPack

As you may have heard, the creators of WordPress has created a new plugin called JetPack. While I will not explain it as the link to the left will explain it far more easy then me (although this link is a good place to start with: Jetpack to the WP.com Cloud) , I am posting about how it may have issues with Lighttpd.

When it first came out I decided to give it a try and it never worked. Posted on Twitter and people advised about disabling cache software like WP Super Cache or W3 Total Cache. Either way, it never worked. The next thing was to disable CloudFlare which also never worked.

Matt advised to contact WordPress support and so I did. After a few e-mails, Mike from WordPress got involved. After a few e-mails back and fore, Mike finally came up with the following which I will post word by word.

Thanks 🙂 Here’s what I found out.

Background: to forge the connection, the Jetpack plugin talks to the Jetpack server (hosted at WordPress.com). The Jetpack server then makes a separate request behind the scenes back to your blog to make sure your blog is publicly accessible and configured correctly. That second request comes from jetpack.wordpress.com and goes to http://snat.co.uk/xmlrpc.php?for=jetpack

It’s that second request that is failing.

The Jetpack plugin is not even getting loaded when that http://snat.co.uk/xmlrpc.php?for=jetpack request is made. I believe this is because lighttpd or something else is using overly aggressive cacheing.

Look at
http://snat.co.uk/xmlrpc.php
http://en.blog.wordpress.com/xmlrpc.php

Both show “XML-RPC server accepts POST requests only.” which is the correct response.

Now look at
http://snat.co.uk/xmlrpc.php?rsd
http://en.blog.wordpress.com/xmlrpc.php?rsd

Your site still shows the “XML-RPC server accepts POST requests only.” message, when it should show some XML likeen.blog.wordpress.com does.

I believe something similar is happening with Jetpack’s http://snat.co.uk/xmlrpc.php?for=jetpack. Your server is responding with a cached copy as if it were a request to http://snat.co.uk/xmlrpc.php, which does not load all the needed Jetpack code.

Mike

And Mike was right, it was lighttpd. After having a look at Lighttpd and having a little test, the only logical solution I could come up with was the rewrite. And I was right. After Ricko changed it for me, JetPack worked easily. Now, this post would not be complete if I did not write what I changed it too.

url.rewrite-if-not-file = (
“^/(wp-.+).*/?” => “$0”,
“^/images/.*/?” => “$0”,
“^/temp/.*/?” => “$0”,
“^/keyword/([A-Za-z_0-9\-]+)/?$” => “/index.php?keyword=$1”,
“^/.*?(\?.*)?$” => “/index.php$1”
)

So if you are having a problem with XMP-PRC on Lighttpd, look at above and give it a try.