use async_trait::async_trait; use pingora::prelude::*; use pingora::proxy::{http_proxy_service, ProxyHttp, Session}; struct Gateway; #[async_trait] impl ProxyHttp for Gateway { type CTX = (); fn new_ctx(&self) -> Self::CTX {} async fn upstream_peer( &self, _session: &mut Session, _ctx: &mut Self::CTX, ) -> Result> { // Forward the request to your local app. let app = ("127.0.0.1", 3000); Ok(Box::new(HttpPeer::new(app, false, String::new()))) } } fn main() { let mut server = Server::new(None).unwrap(); server.bootstrap(); let mut proxy = http_proxy_service( &server.configuration, Gateway, ); proxy.add_tcp("127.0.0.1:8080"); server.add_service(proxy); server.run_forever(); }