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 easier than 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 me 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 to.

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 the above and give it a try.

Need to reference?

Ellis, M. (2011). Lighttpd and JetPack. [online] Snat's Narratives & Tales. Available at: https://snat.co.uk/stem/scripts/lighttpd-and-jetpack.html [Accessed 19 Mar 2024].


Steam Key Giveaway!

Every month on the final Sabbath, I take a random comment that has been posted that month and for that lucky winner they will win a random key from G2A! Join Discord for any questions or leave a comment!

Thanks for reading! You may be interested in this …

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Rodger

I was needing to try this and I am not sure where you put this. Did it go into the Lighttpd.conf or did you enter this as a custom rerwite rule in Kloxo? Thanks!!!!

Snat

I inserted it into lighttpd.conf, I don’t like control panels doing anything for me.

Ahmed Ali

i tried every troubleshoot available on internet but all in vain my jet pack is not working 🙁 please anyone help me out to remove this error Error Details: The Jetpack server could not communicate with your site’s XML-RPC URL. Please check to make sure http://v************.com/xmlrpc.php is working properly. It should show ‘XML‑RPC server accepts POST requests only.’ on a line by itself when viewed in a browser and should not have any blank links or extra output anywhere. i tried every procedure and my site is on shared hosting kindly tell me step by step procedure for what to… Read more »

Snat

Ask your host if they have any caching on their side – if they do this may mess things up. Also make sure your .htaccess file is correct.

The method I wrote about won’t work for you as cPanel uses Apache and not Lighttpd 🙁

I would suggest you post on the WordPress forums, the creators of the plugin lurks around there.