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.

8 thoughts on “Lighttpd and JetPack

  1. Snat

    Going to update this. 

    I have had some people contact me about it still not working. Make sure that your lighttp rewrite has “url.rewrite-if-not-file” else it will fail.

    Reply
  2. Christoph

    It might be another problem in special cases. Your Post helped me a lot to find this.

    We limited the User Agents in our site to a fake agent to avoid real traffic on the site while building it. We did this in .htaccess file.

    To be sure, that JetPack is working, you have to turn off this limitation or add “The Incutio XML-RPC PHP Library” to the allowed user agents.

    Reply
  3. 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!!!!

    Reply
  4. Pingback: Wordpress (nginx-varnish) Jetpack xml_rpc 32700 glitch fix

  5. 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 do

    i tried:

    deactivation of plugins – fail
    editing in wp-config.php – fail
    lighttpd.config – i can’t find this file where it locates in cpanel kindly guide me

    Please help me out to get rid of this error 🙁

    Reply
    1. Snat Post author

      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.

      Reply

Leave a Reply