PE-5869 Provide error details on proxying failure

This PR adds support for handling proxying failures so that in case of a proxying failure we could show something better than a blank page and status code 502.
We should probably rename this to `:failure-fn` to remain consistent with the other callback keys.