A simple reverse proxy for use with Hyper and Tokio
Go to file
2024-05-21 18:06:21 +02:00
.github/workflows chore: update benches 2022-06-11 15:21:54 -03:00
benches Replace lazy_static with OnceLock. 2024-05-19 11:07:09 -07:00
examples Replace lazy_static with OnceLock. 2024-05-19 11:07:09 -07:00
src Merge remote-tracking branch 'stefansundin/allow-debug-clone' 2024-05-21 18:06:21 +02:00
tests Replace lazy_static with OnceLock. 2024-05-19 11:07:09 -07:00
.gitignore port lib to hyper 0.13 and future 0.3 2020-05-04 00:18:27 -03:00
.travis.yml Initial commit 2017-07-15 16:28:59 +10:00
Cargo.toml Replace lazy_static with OnceLock. 2024-05-19 11:07:09 -07:00
LICENSE Initial commit 2017-07-15 16:28:59 +10:00
README.md Remove outdated information since hyper-trust-dns is no longer used in the example. 2024-05-16 21:18:41 -07:00

This is a fork

This repo contains a fork of the original hyper-reverse-proxy codebase, adding to it a few improvements:

  • Fix to a bug where the Host header was getting overwritten on the upstream HTTP request.

  • Upgraded hyper version to 1.x (and fixes related to that upgrade)

  • Logging cleanup

Plus more as time goes on.

hyper-reverse-proxy

License docs version

A simple reverse proxy, to be used with Hyper.

The implementation ensures that Hop-by-hop headers are stripped correctly in both directions, and adds the client's IP address to a comma-space-separated list of forwarding addresses in the X-Forwarded-For header.

The implementation is based on Go's httputil.ReverseProxy.

Example

Run the example by cloning this repository and running:

cargo run --example simple

The example will set up a reverse proxy listening on 127.0.0.1:8000, and will proxy these calls:

  • http://service1.localhost:8000 will be proxied to http://127.0.0.1:13901

  • http://service2.localhost:8000 will be proxied to http://127.0.0.1:13902

  • All other URLs will display request information.