Webmention

I'm now sending and receiving Webmentions on this site!

Webmention is similar to Pingback, except it is simpler to implement. I wrote my own Webmention handler following the spec on the W3C web site.

The core concept is that an HTTP endpoint receives a POST request with two variables set: source and target. When sending outbound Webmention requests (e.g. links from your site to an external site), the source will be a page on your site, and the target will be the external site. When receiving inbound Webmention requests (e.g. an external site linking to your site), the source will be the external site, and the target will be a page on your site.

The Webmention protocol requires that the source and target are valid URLs and that the source actually links to the target. Checking that the source links to the target requires retrieving the source over the network and parsing it for links. That lends itself to abuse by malicious actors if the processing is done synchronously. To mitigate some of the abuse risk, my Webmention receiver processes inbound and outbound requests asychronously (i.e., by storing the requests in a database and processing them later via a cron job).

Pingback was plagued with spam almost from inception, and if Webmention is more widely implemented, it will most likely suffer the same fate. There are multiple extensions to Webmention (like Vouch) that try to reduce unwanted spam. I'll be implementing Vouch in the near future on my site.

What happens once a Webmention is received and processed? The spec doesn't define any required action beyond the HTTP 202 - Accepted response on success or HTTP 400 - Bad Request on failure. I intend to publish any Webmention requests as comments on the blog post for which the request was received. The code to handle that portion of the process is still in progress.

For now, I am sending the Webmention endpoint URL for each blog post on my site as part of the Link header. Most Webmention libraries should be able to retrieve and parse the endpoint from that header.

At some point, once I feel comfortable with my Webmention implementation, I'll likely release it on Github under a BSD-style license.

Tags: webmention

No comments yet.



Is ice hot or cold?