omjadas / hudsucker

Intercepting HTTP/S proxy
https://crates.io/crates/hudsucker
Apache License 2.0
209 stars 37 forks source link

ADD failed proxy error handler #50

Closed wabscale closed 1 year ago

wabscale commented 1 year ago

I'm trying to integrate this into a small service within a cluster I run and I've found that a failed proxy requests by default result in an empty server response with no error message server side. I've found that this comes from one somewhat unsafe ? unwrap in the internal proxy.

I've slightly modified this so that there is now a handle_error on the HttpHandler trait that takes the error from hyper and returns a response. By default I have it returning a 502 Bad Gateway.

omjadas commented 1 year ago

Thanks for the PR! I have requested a few small changes.

wabscale commented 1 year ago

No problem, have responded to them. Appologies for the bad rust, I only learned it yesterday.