{"id":21966347,"url":"https://github.com/danielsanchezq/warp-reverse-proxy","last_synced_at":"2025-08-01T13:37:59.915Z","repository":{"id":40483897,"uuid":"285769688","full_name":"danielSanchezQ/warp-reverse-proxy","owner":"danielSanchezQ","description":"Fully composable warp filter that can be used as a reverse proxy. ","archived":false,"fork":false,"pushed_at":"2024-04-01T04:51:47.000Z","size":88,"stargazers_count":48,"open_issues_count":5,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T18:19:21.265Z","etag":null,"topics":["reverse-proxy","rust","warp"],"latest_commit_sha":null,"homepage":"https://github.com/danielSanchezQ/warp-reverse-proxy","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielSanchezQ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-07T07:44:20.000Z","updated_at":"2025-02-28T16:52:29.000Z","dependencies_parsed_at":"2024-05-17T03:45:41.439Z","dependency_job_id":null,"html_url":"https://github.com/danielSanchezQ/warp-reverse-proxy","commit_stats":{"total_commits":71,"total_committers":9,"mean_commits":7.888888888888889,"dds":0.3943661971830986,"last_synced_commit":"f44dba4336a9dbbef6463ca0b3721ed460cff2b3"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielSanchezQ%2Fwarp-reverse-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielSanchezQ%2Fwarp-reverse-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielSanchezQ%2Fwarp-reverse-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielSanchezQ%2Fwarp-reverse-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielSanchezQ","download_url":"https://codeload.github.com/danielSanchezQ/warp-reverse-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713258,"owners_count":20983683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["reverse-proxy","rust","warp"],"created_at":"2024-11-29T13:02:06.838Z","updated_at":"2025-04-07T19:14:20.615Z","avatar_url":"https://github.com/danielSanchezQ.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# warp-reverse-proxy\n\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![GHA Build Status](https://github.com/danielsanchezq/warp-reverse-proxy/workflows/CI/badge.svg)](https://github.com/danielsanchezq/warp-reverse-proxy/actions?query=workflow%3ACI)\n[![Docs Badge](https://docs.rs/warp-reverse-proxy/badge.svg)](https://docs.rs/warp-reverse-proxy)\n\nFully composable [warp](https://github.com/seanmonstar/warp) filter that can be used as a reverse proxy. It forwards the request to the \ndesired address and replies back the remote address response.\n\n### Add the library dependency\n```toml\n[dependencies]\nwarp = \"0.3\"\nwarp-reverse-proxy = \"1\"\n```\n\n### Use it as simple as:\n```rust\nuse warp::{hyper::Body, Filter, Rejection, Reply, http::Response};\nuse warp_reverse_proxy::reverse_proxy_filter;\n\nasync fn log_response(response: Response\u003cBody\u003e) -\u003e Result\u003cimpl Reply, Rejection\u003e {\n    println!(\"{:?}\", response);\n    Ok(response)\n}\n\n#[tokio::main]\nasync fn main() {\n    let hello = warp::path!(\"hello\" / String).map(|name| format!(\"Hello, {}!\", name));\n    // // spawn base server\n    tokio::spawn(warp::serve(hello).run(([0, 0, 0, 0], 8080)));\n    // Forward request to localhost in other port\n    let app = warp::path!(\"hello\" / ..).and(\n        reverse_proxy_filter(\"\".to_string(), \"http://127.0.0.1:8080/\".to_string())\n            .and_then(log_response),\n    );\n    // spawn proxy server\n    warp::serve(app).run(([0, 0, 0, 0], 3030)).await;\n}\n```\n\n\n### For more control. You can compose inner library filters to help you compose your own reverse proxy:\n\n```rust\n#[tokio::main]\nasync fn main() {\n    let hello = warp::path!(\"hello\" / String).map(|name| format!(\"Hello port, {}!\", name));\n\n    // // spawn base server\n    tokio::spawn(warp::serve(hello).run(([0, 0, 0, 0], 8080)));\n\n    let request_filter = extract_request_data_filter();\n    let app = warp::path!(\"hello\" / String)\n        // build proxy address and base path data from current filter\n        .map(|port| (format!(\"http://127.0.0.1:{}/\", port), \"\".to_string()))\n        .untuple_one()\n        // build the request with data from previous filters\n        .and(request_filter)\n        .and_then(proxy_to_and_forward_response)\n        .and_then(log_response);\n\n    // spawn proxy server\n    warp::serve(app).run(([0, 0, 0, 0], 3030)).await;\n}\n```\n\n### Requests client initialization\n\nBy default, a simple `reqwests::Client` is initialized and used.\nIn case some specific client configuration need to be used it can be overridden:\n\n```rust\nuse warp_reverse_proxy::{reverse_proxy_filter, CLIENT as PROXY_CLIENT};\n\n#[tokio::main]\nasync fn main() {\n    let client = reqwest::Client::builder()\n        .default_headers(headers)\n        .build().expect(\"client goes boom...\");\n    PROXY_CLIENT.set(client).expect(\"client couldn't be set\");\n    ...\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsanchezq%2Fwarp-reverse-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielsanchezq%2Fwarp-reverse-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsanchezq%2Fwarp-reverse-proxy/lists"}