1 unstable release
0.1.0 | Jan 5, 2024 |
---|
#73 in #http-header
488 downloads per month
72KB
951 lines
axum-core
- Security Middleware for the axum
web framework
It works by setting HTTP headers for you. These headers can help protect your app from some well-known web vulnerabilities:
- Cross-Origin-Embedder-Policy
- Cross-Origin-Opener-Policy
- Cross-Origin-Resource-Policy
- Origin-Agent-Cluster
- Referrer-Policy
- Strict-Transport-Security
- X-Content-Type-Options
- X-DNS-Prefetch-Control
- X-Download-Options
- X-Frame-Options
- X-Permitted-Cross-Domain-Policies
- X-XSS-Protection
- X-Powered-By
- Content-Security-Policy
Usage
Add this to your Cargo.toml
:
[dependencies]
axum-helmet = "0.1"
Example
use axum::{self, Router};
use axum_helmet::Helmet;
let app = Router::new()
.route("/", axum::handler::get(|| async { "Hello, World!" }))
.layer(Helmet::default());
// ...
License
This project is licensed under the MIT license.
Dependencies
~5–11MB
~124K SLoC