mirror of https://github.com/rwf2/Rocket.git
Improvements to configuration and requests guides.
This commit is contained in:
parent
51a465f2cc
commit
f182f65054
|
@ -170,8 +170,18 @@ ROCKET_DICT={key="abc",val=123}
|
||||||
|
|
||||||
## Configuring TLS
|
## Configuring TLS
|
||||||
|
|
||||||
TLS (Transport Layer Security) is configured through the `tls` configuration
|
Rocket includes built-in, native support for TLS >= 1.2 (Transport Layer
|
||||||
parameter. The value of `tls` must be a table with two keys:
|
Security). In order for TLS support to be enabled, Rocket must be compiled with
|
||||||
|
the `"tls"` feature. To do this, add the `"tls"` feature to the `rocket`
|
||||||
|
dependency in your `Cargo.toml` file:
|
||||||
|
|
||||||
|
```
|
||||||
|
[dependencies]
|
||||||
|
rocket = { version = "0.2.8", features = ["tls"] }
|
||||||
|
```
|
||||||
|
|
||||||
|
TLS is configured through the `tls` configuration parameter. The value of `tls`
|
||||||
|
must be a table with two keys:
|
||||||
|
|
||||||
* `certs`: _[string]_ a path to a certificate chain in PEM format
|
* `certs`: _[string]_ a path to a certificate chain in PEM format
|
||||||
* `key`: _[string]_ a path to a private key file in PEM format for the
|
* `key`: _[string]_ a path to a private key file in PEM format for the
|
||||||
|
@ -192,11 +202,8 @@ Of course, you can always specify the configuration values per environment:
|
||||||
tls = { certs = "/path/to/certs.pem", key = "/path/to/key.pem" }
|
tls = { certs = "/path/to/certs.pem", key = "/path/to/key.pem" }
|
||||||
```
|
```
|
||||||
|
|
||||||
In order for TLS support to be enabled, Rocket must be compiled with the `"tls"`
|
Or via environment variables:
|
||||||
feature. To do this, add the `"tls"` feature to the `rocket` dependency in your
|
|
||||||
`Cargo.toml` file:
|
|
||||||
|
|
||||||
```
|
```sh
|
||||||
[dependencies]
|
ROCKET_TLS={certs="/path/to/certs.pem",key="/path/to/key.pem"} cargo run
|
||||||
rocket = { version = "0.2.8", features = ["tls"] }
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -411,7 +411,7 @@ fn user_id(cookies: Cookies) -> Option<String> {
|
||||||
#[post("/logout")]
|
#[post("/logout")]
|
||||||
fn logout(mut cookies: Cookies) -> Flash<Redirect> {
|
fn logout(mut cookies: Cookies) -> Flash<Redirect> {
|
||||||
cookies.remove_private(Cookie::named("user_id"));
|
cookies.remove_private(Cookie::named("user_id"));
|
||||||
Flash::success(Redirect::to("/login"), "Successfully logged out.")
|
Flash::success(Redirect::to("/"), "Successfully logged out.")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue