Registry / web-framework / actix-cors

actix-cors

JSON →
library0.7.1rscratesunverified

Cross-Origin Resource Sharing (CORS) controls for Actix Web.

# Cargo.toml [dependencies] actix-cors = "0.7.1"
INSTALL
IMPORT
SIG · ACTIX-CORS
A
actix-cors
web-frameworkrustv0.7.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Cors
use actix_cors::Cors;

Configures CORS middleware for an Actix Web server.

use actix_cors::Cors; use actix_web::{web, App, HttpServer, HttpResponse}; async fn index() -> HttpResponse { HttpResponse::Ok().body("Hello") } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { let cors = Cors::default() .allowed_origin("https://example.com") .allowed_methods(vec!["GET", "POST"]); App::new() .wrap(cors) .route("/", web::get().to(index)) }) .bind("127.0.0.1:8080")? .run() .await }
Debug
Known issues
gotchaRequires actix-web runtime (actix-rt or tokio)
fix
Add actix-web dependency and use #[actix_web::main]
affects: >=0.7.0
Upgrade
Version history
0.7.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
41 hits · last 30 days
node
34
OpenAI (training)
2
Amazon
1
Resources
actix-cors — cargo add actix-cors · libregistry