Record credit failures

Another step of #2508. Fixes #1811. Built on top of #2579.
What's the behavior at Heroku if a client sends `X-Forwarded-For`? Do they replace it?