1
0
mirror of https://github.com/actix/examples synced 2024-11-23 14:31:07 +01:00
examples/middleware/http-to-https
2024-07-19 15:44:43 +01:00
..
src chore: upgrade to rustls v0.23 2024-05-25 05:36:36 +01:00
Cargo.toml chore: upgrade to rustls v0.23 2024-05-25 05:36:36 +01:00
cert.pem chore: rename middleware dirs 2023-10-29 23:51:05 +00:00
key.pem chore: rename middleware dirs 2023-10-29 23:51:05 +00:00
README.md fix: update broken link (#858) 2024-07-19 15:44:43 +01:00

Middleware: Redirect Any HTTP Connection To Use HTTPS Connection

Alternatives

A pre-built solution is soon to be built-in. For now, see RedirectHttps from actix-web-lab.

This Example

This example is the next step after implementing this example : Setup TLS via rustls.

You might have already implemented TLS (using one of the ways mentioned in the example of security section), and have setup your server to listen to port 443 (for HTTPS).

Now, the only problem left to solve is, to listen to HTTP connections as well and redirect them to use HTTPS

Usage

cd middleware/http-to-https
cargo run