I faced a problem a few weeks ago with 0pdd.com, one of my web apps that is supposed to receive HTTP requests (known as webhooks) from GitHub: sometimes the app is down, GitHub gets an HTTP error, and never sends the request again. The request simply gets lost. There is absolutely no way to receive it again once the app is back up. I realized that I needed a service mesh between GitHub and my web app, to accept HTTP requests and repeat them later if they can’t be delivered immediately.
I created rehttp.net to do exactly that.
See, the URL I’ve been giving to GitHub is this one:
https://www.0pdd.com/hook/github
From now on a new URL has to be used:
https://www.rehttp.net/p/https://www.0pdd.com/hook/github
It looks very similar, but starts with https://www.rehttp.net/p/
. GitHub sends all webhook PUT/POST requests to the ReHTTP server, which stores them in a temporary database (I’m using AWS DynamoDB).
ReHTTP attempts to deliver them immediately. If something goes wrong and the server HTTP response code is not in the 200-299 range, the next attempt is made in about an hour. Then it retries every hour for about a day. If all attempts fail, it abandons the request and that’s it.
What is interesting is that now I can see a summary of my API here. I see how many requests were processed successfully over the last 24 hours and how many of them failed. Also, I have this cute button:
And I have a URL for checking the status of the entire API:
https://www.rehttp.net/s?u=http%3A%2F%2Fwww.0pdd.com%2Fhook%2Fgithub
I gave this URL to StatusCake to ping it every five minutes. If and when something goes wrong, StatusCake will email me and drop me a message on the phone.
ReHTTP is absolutely free. It is written in Java and the code is open. See its GitHub repository and contribute if you find any bugs or just want to add a feature.