redirectionio-actix-proxy

Crates.ioredirectionio-actix-proxy
lib.rsredirectionio-actix-proxy
version0.1.0
created_at2024-12-17 09:42:48.624707+00
updated_at2024-12-17 09:42:48.624707+00
descriptionActix web reverse HTTP and Websocket proxy
homepage
repositoryhttps://github.com/redirectionio/actix-proxy
max_upload_size
id1485981
size142,048
Joel Wurtz (joelwurtz)

documentation

README

Actix proxy service

Reverse HTTP and websocket service for Actix Web.

Provides a service for Actix Web that can be used to proxy requests from client to another server.

Examples

use actix_web::{guard, middleware, App, HttpServer};
use redirectionio_actix_proxy::{HttpPeer, Proxy};
use std::net::ToSocketAddrs;

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
    let address = "127.0.0.1:80"
        .to_socket_addrs()
        .expect("error getting addresses")
        .next()
        .expect("cannot get address");

    HttpServer::new(move || {
        App::new()
            .service(Proxy::new(HttpPeer::new(address, "my-proxy.com")))
    })
        .bind(("127.0.0.1", 8080))?
        .workers(2)
        .run()
        .await
}
Commit count: 7

cargo fmt