1
0
mirror of https://github.com/actix/examples synced 2024-11-24 06:43:00 +01:00
examples/middleware/middleware-http-to-https/README.md

12 lines
700 B
Markdown
Raw Normal View History

2022-02-18 03:18:44 +01:00
## Middleware: Redirect Any HTTP Connection To Use HTTPS Connection
This example is the next step after implementing this example : [Setup TLS via rustls](https://github.com/actix/examples/tree/master/security/rustls).
2022-02-18 03:18:44 +01:00
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).
2022-02-18 03:18:44 +01:00
Now, the only problem left to solve is, to listen to **HTTP** connections as well and redirect them to use **HTTPS**
2022-02-18 03:18:44 +01:00
## Notes
2022-02-18 03:18:44 +01:00
Also see [`redirect_to_https`](https://docs.rs/actix-web-lab/0/actix_web_lab/middleware/fn.redirect_to_https.html) from [`actix-web-lab`](https://crates.io/crates/actix-web-lab).