ntex-helmet

HTTP security headers middleware for ntex-web

4 releases

0.1.3 Jan 5, 2024
0.1.2 Dec 30, 2023
0.1.1 Dec 30, 2023
0.1.0 Dec 30, 2023

MIT license

115KB
2K SLoC

ntex-helmet - Security Middleware for ntex web framework

crate docs

ntex-helmet is a security middleware for the ntex web framework. It's based on the helmet middleware for Node.js.

It works by setting HTTP headers for you. These headers can help protect your app from some well-known web vulnerabilities:

Usage

Add this to your Cargo.toml:

[dependencies]
ntex-helmet = "0.1"

Example

use ntex::web::{self, App, HttpResponse};
use ntex_helmet::Helmet;

#[ntex::main]
fn main() {
    let app = App::new()
        .wrap(Helmet::default())
        .service(web::resource("/").to(|| HttpResponse::Ok()));

    // ...
}

License

This project is licensed under the MIT license.

Dependencies

~15–27MB
~497K SLoC