Commit b721e37a authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

Add CORS header handling

parent 96de19c8
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -62,6 +62,20 @@ dependencies = [
 "trust-dns-resolver",
]

[[package]]
name = "actix-cors"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "778c96f5953144b8986fafee72b3809642c1b5050a2552a97dc02247f00b4155"
dependencies = [
 "actix-web",
 "derive_more",
 "futures-util",
 "log",
 "once_cell",
 "tinyvec 1.0.1",
]

[[package]]
name = "actix-files"
version = "0.4.0"
@@ -2591,6 +2605,7 @@ name = "webrtc-audio-server"
version = "0.1.0"
dependencies = [
 "actix",
 "actix-cors",
 "actix-files",
 "actix-rt",
 "actix-service",
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ actix-web = { version = "3", features = ["openssl"] }
actix-web-actors = "3"
actix-service = "1"
actix-files = "0.4"
actix-cors = "0.5"
openssl = "0.10"
log = "0.4"
env_logger = "0.8"
+3 −0
Original line number Diff line number Diff line
@@ -85,7 +85,10 @@ pub async fn run(cfg: Config) -> Result<(), anyhow::Error> {
    let cfg_clone = cfg.clone();

    let server = HttpServer::new(move || {
        let cors = actix_cors::Cors::default().allow_any_origin().max_age(3600);

        App::new()
            .wrap(cors)
            .app_data(cfg_clone.clone())
            .app_data(rooms.clone())
            .route("/", web::get().to(index))