pub struct GrpcProxy { /* private fields */ }Expand description
gRPC reverse proxy middleware.
Recognises requests with Content-Type: application/grpc* and forwards them
to a backend over HTTP/2, leaving all other requests to the next layer.
gRPC DATA frames are forwarded as-is because gRPC is layered directly on
HTTP/2. HTTP/2 trailers (grpc-status, grpc-message) are not yet
propagated — a known limitation of the current implementation.
Requires the http2 Cargo feature.
§Example
use rust_web_server::app::App;
use rust_web_server::core::New;
use rust_web_server::proxy::GrpcProxy;
let app = App::new()
.wrap(GrpcProxy::new(["grpc-service:50051"]));Implementations§
Trait Implementations§
Source§impl Middleware for GrpcProxy
Available on crate feature http2 only.
impl Middleware for GrpcProxy
Available on crate feature
http2 only.fn handle( &self, request: &Request, connection: &ConnectionInfo, next: &dyn Application, ) -> Result<Response, String>
Auto Trait Implementations§
impl !Freeze for GrpcProxy
impl RefUnwindSafe for GrpcProxy
impl Send for GrpcProxy
impl Sync for GrpcProxy
impl Unpin for GrpcProxy
impl UnsafeUnpin for GrpcProxy
impl UnwindSafe for GrpcProxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more