Skip to main content

dispatch_to_service

Function dispatch_to_service 

Source
pub async fn dispatch_to_service(
    service: &'static str,
    registry: Arc<ServiceRegistry>,
    config: Arc<DispatchConfig>,
    request: Request<Body>,
) -> Response<Body>
Expand description

Dispatch an in-process request straight to one REST-protocol service ("s3"), bypassing the HTTP router and service detection.

The CloudFront data plane fetches an S3 origin this way: the request is by construction an S3 request addressed to the origin bucket (via its Host), so no viewer path (/_fakecloud/*, /latest/*, …) can reach one of fakecloud’s own routes, and no viewer header (X-Amz-Target, an Authorization scoped to another service, ?Action=) can steer it to another service. Authentication and IAM enforcement run exactly as for any request, including an InternalCaller extension. The source address is the request’s ConnectInfo<SocketAddr> extension, or loopback.