1
0
mirror of https://github.com/actix/examples synced 2024-11-23 14:31:07 +01:00

fix cd links

This commit is contained in:
Rob Ede 2022-02-18 02:18:44 +00:00
parent 357983d22c
commit 4d210b32f9
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
8 changed files with 20 additions and 27 deletions

View File

@ -5,7 +5,7 @@ Basic integration of [Casbin-RS](https://github.com/casbin/casbin-rs) with [RBAC
## Usage
```sh
cd security/casbin
cd auth/casbin
```
Modify the files in the `rbac` directory and the code in the `src` directory as required.
@ -13,7 +13,7 @@ Modify the files in the `rbac` directory and the code in the `src` directory as
## Running Server
```sh
cd security/casbin
cd auth/casbin
cargo run (or ``cargo watch -x run``)
# Started http server: 127.0.0.1:8080

View File

@ -1,7 +1,7 @@
# cookie-auth
```sh
cd session/cookie-auth
cd auth/cookie-auth
cargo run
# Starting http server: 127.0.0.1:8080
```

View File

@ -1,7 +1,7 @@
## Cookie session example
```sh
cd session/cookie-session
cd auth/cookie-session
cargo run
# Starting http server: 127.0.0.1:8080
```

View File

@ -1,7 +1,7 @@
# redis-session
```sh
cd session/redis-sessions
cd auth/redis-sessions
cargo run
# Starting http server: 127.0.0.1:8080
```
@ -11,4 +11,4 @@ cargo run
- [GET /](http://localhost:8080/)
- [POST /do_something](http://localhost:8080/do_something)
- [POST /login](http://localhost:8080/login)
- [POST /logout](http://localhost:8080/logout)
- [POST /logout](http://localhost:8080/logout)

View File

@ -2,14 +2,14 @@
## Run Server
```sh
cd secutiy/web-cors/backend
cd cors/backend
cargo run
```
## Run Frontend
In a separate terminal, also run:
```sh
cd secutiy/web-cors/frontend
cd cors/frontend
npm install
npm run serve
```

View File

@ -1,6 +1,6 @@
# middleware examples
# Middleware: Add/Retrieve Request-Local Data
This example showcases a middleware that adds and retrieves request-local data. See also the [Middleware guide](https://actix.rs/docs/middleware/).
This example showcases a middleware that adds and retrieves request-local data. See also the [middleware guide](https://actix.rs/docs/middleware/).
## Usage

View File

@ -1,12 +1,11 @@
## Middleware eg - redirect any http connection to use https connection
## 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).
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).
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**
Now, the only problem left to solve is, to listen to **HTTP** connections as well and redirect them to use **HTTPS**
## Usage
**Note :** You will be required to use sudo while running the binary to access port 80 and 443
## Notes
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).

View File

@ -1,13 +1,7 @@
use std::fs::File;
use std::io::BufReader;
use std::{fs::File, io::BufReader};
use actix_web::dev::Service;
use futures::future::FutureExt;
use actix_web::{get, App, HttpServer};
use actix_web::{http, HttpResponse};
use futures::future;
use futures::future::Either;
use actix_web::{dev::Service, get, http, App, HttpResponse, HttpServer};
use futures::future::{self, Either, FutureExt};
use rustls::{Certificate, PrivateKey, ServerConfig};
use rustls_pemfile::{certs, pkcs8_private_keys};
@ -65,8 +59,8 @@ async fn main() -> std::io::Result<()> {
})
.service(index)
})
.bind("0.0.0.0:80")? // Port 80 to listen for http request
.bind_rustls("0.0.0.0:443", config)? // Port 443 to listen for https request
.bind("127.0.0.1:80")? // Port 80 to listen for HTTP request
.bind_rustls("127.0.0.1:443", config)? // Port 443 to listen for HTTPS request
.run()
.await
}