Introduction | laravel-csp-rust | Spatie       

 SPATIE  

laravel-csp-rust
================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-csp-rust](https://spatie.be/docs/laravel-csp-rust/v1)  Introduction

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-csp-rust/v1) 

  Introduction    
- [ Introduction ](https://spatie.be/docs/laravel-csp-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-csp-rust/v1/support-us)
- [ Installation and setup ](https://spatie.be/docs/laravel-csp-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-csp-rust/v1/usage)
- [ Creating a preset ](https://spatie.be/docs/laravel-csp-rust/v1/creating-a-preset)
- [ Using inline scripts and styles ](https://spatie.be/docs/laravel-csp-rust/v1/using-inline-scripts-and-styles)
- [ Outputting a CSP policy as a meta tag ](https://spatie.be/docs/laravel-csp-rust/v1/outputting-a-csp-policy-as-a-meta-tag)
- [ Reporting CSP errors ](https://spatie.be/docs/laravel-csp-rust/v1/reporting-csp-errors)
- [ Testing ](https://spatie.be/docs/laravel-csp-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/laravel-csp-rust/v1/changelog)
- [ Releasing ](https://spatie.be/docs/laravel-csp-rust/v1/releasing)

  Laravel-csp-rust 
==================

 Set Content Security Policy headers in a Laravel Rust app 

### Useful links

- [Repository](https://github.com/spatie/laravel-csp-rust)
- [Discussions](https://github.com/spatie/laravel-csp-rust/discussions)

Introduction
------------

Set content security policy headers in a Laravel Rust app
===================================================================================================================================================================================================================================

By default, scripts on a webpage can send and fetch data to any site they want. This can be a security problem. Imagine one of your JavaScript dependencies sends all keystrokes, including passwords, to a third party website.

Setting Content Security Policy headers helps solve this problem. These headers dictate which sites your site is allowed to contact. This package makes it easy for you to set the right headers.

This documentation does not aim to fully explain all possible usages of CSP and its directives. We highly recommend that you read [Mozilla's documentation on Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) before using this package.

Start with [installation and setup](installation-and-setup), then [usage](usage). You can compose service presets, write custom policies, try changes in report-only mode, and report violations to an endpoint of your choice. Laravel's native nonce handling connects policies to templates and Vite tags.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
