<div align="center">
<img src="https://devhub.vip/pages/docs/img/hyperlane.png" alt="hyperlane-plugin-cors logo" height="120">
# hyperlane-plugin-cors
**Zero-Allocation Precompiled RFC-Compliant CORS Middleware Plugin**
[](https://crates.io/crates/hyperlane-plugin-cors)
[](https://docs.rs/hyperlane-plugin-cors)
[](https://github.com/hyperlane-dev/hyperlane/actions/workflows/rust.yml)
[](https://www.rust-lang.org)
[](../../LICENSE)
[Workspace Overview](../../README.md) · [Plugin Catalog](../README.md) · [API Docs](https://docs.rs/hyperlane-plugin-cors/latest/)
</div>
---
## Overview
`hyperlane-plugin-cors` adds zero-allocation Cross-Origin Resource Sharing (CORS) policy enforcement and preflight handling to [`hyperlane`](../../README.md) services (hook order `-100` / `-80`). It is opt-in and transparent (`Status::Continue`) when unconfigured.
## Installation
```sh
cargo add hyperlane-plugin-cors
```
## Usage
```rust
use hyperlane_plugin_cors::{CorsConfig, CorsPlugin};
fn setup_cors() {
CorsPlugin::init(CorsConfig::default());
}
```
## Verification
```sh
cargo run -p hyperlane-cli -- fmt --check
cargo clippy -p hyperlane-plugin-cors --all-features --all-targets -- -D warnings
cargo test -p hyperlane-plugin-cors --all-features
```
## License
This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details.
## Contact
For inquiries, please contact the author at [root@devhub.vip](mailto:root@devhub.vip).