| Crates.io | http-to-https-redirect |
| lib.rs | http-to-https-redirect |
| version | 0.1.0 |
| created_at | 2025-10-28 21:16:55.114779+00 |
| updated_at | 2025-10-28 21:16:55.114779+00 |
| description | A lightweight HTTP to HTTPS redirect server |
| homepage | |
| repository | https://github.com/jvtubergen/http-to-https-redirect |
| max_upload_size | |
| id | 1905677 |
| size | 22,218 |
A lightweight Rust server that listens on port 80 and automatically redirects all HTTP requests to HTTPS using 301 (Moved Permanently) status codes, preserving the hostname, path, and query parameters.
cargo install http-to-https-redirect
Simply run the binary with appropriate permissions:
sudo http-to-https-redirect
Note: Running on port 80 requires root privileges or CAP_NET_BIND_SERVICE capability.
Grant the binary permission to bind to privileged ports:
sudo setcap 'cap_net_bind_service=+ep' $(which http-to-https-redirect)
http-to-https-redirect
When a client requests:
http://example.com/path?query=value
They will be redirected to:
https://example.com/path?query=value
Run this alongside your HTTPS server to ensure all traffic uses secure connections. This is particularly useful for:
git clone https://github.com/jvtubergen/http-to-https-redirect
cd http-to-https-redirect
cargo build --release
The binary will be available at target/release/http-to-https-redirect.
Licensed under the MIT License. See LICENSE.md or http://opensource.org/licenses/MIT for details.
Contributions are welcome! Please feel free to submit a Pull Request.