Crate lmrc_proxy

Crate lmrc_proxy 

Source
Expand description

§lmrc-proxy

HTTP reverse proxy and API gateway utilities for LMRC Stack applications.

This library provides:

  • HTTP reverse proxy with configurable behavior
  • Subdomain-based routing
  • Route resolution trait for flexible backend discovery
  • Axum middleware for proxy and routing

§Quick Start

use lmrc_proxy::{
    routing::{StaticRouteResolver, RouteResolver},
    ProxyConfig,
};
use std::sync::Arc;

let resolver = Arc::new(
    StaticRouteResolver::new()
        .add_route("api", "http://api-service:8080")
        .add_route("admin", "http://admin-service:9000")
);

// Use resolver to look up backend URLs
let backend = resolver.resolve("api").await;
assert_eq!(backend, Some("http://api-service:8080".to_string()));

Re-exports§

pub use client::proxy_request;
pub use client::ProxyConfig;
pub use error::ProxyError;
pub use error::ProxyResult;
pub use routing::extract_subdomain;
pub use routing::RouteResolver;
pub use routing::StaticRouteResolver;
pub use middleware::subdomain_extractor;
pub use middleware::subdomain_proxy;
pub use middleware::Subdomain;

Modules§

client
HTTP reverse proxy client
error
Proxy error types
middleware
Proxy middleware
routing
Routing and subdomain handling