Replies: 1 comment 1 reply
-
You can do it like this: use salvo::prelude::*;
use salvo::proxy::Proxy;
#[tokio::main]
async fn main() {
tracing_subscriber::fmt().init();
let router = Router::new().push(
Router::new()
.host("127.0.0.1")
.path("<**rest>")
.handle(Proxy::new("https://www.rust-lang.org")),
).push(
Router::new()
.host("localhost")
.path("<**rest>")
.handle(Proxy::new("https://crates.io")),
);
let acceptor = TcpListener::new("127.0.0.1:5800").bind().await;
Server::new(acceptor).serve(router).await;
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
is it possible to make a proxy to serve multiple domain names listening on port 80 like nginx (servername) using salvo as a base or still not do without nginx. For example domain1.net proxi on app1, domain2.net - app2 ...
Beta Was this translation helpful? Give feedback.
All reactions