- Overall
- Clear Site Data
- HTTP Strict Transport Security
- Public Key Pinning
- Content Security Policy
- Testing
- Each header in config file has a reference link in phpdoc, reading it will help you knowing what the header doing.
- If you want to disable a string type header, just set the value to
nullor empty string''.
- Clear Site Data only supports
httpsprotocol, it will not work inhttpprotocol.
- After setting
hstsheader, you can visit https://hstspreload.org and submit request to add your domain topreload list.
- When
hpkphashesarray is empty, this header will not add to http response.
-
If you want to disable csp header, set
custom-cspto empty string''. -
When a directive is empty array, it will set to
none. If you want to omit a directive, just remove it. -
If you want to allow specific protocol in directive, add them to
schemesarray.'img-src' => [ 'schemes' => [ 'data:', 'https:', ], ],
-
If you want to use automated generated nonce value, setting
add-generated-noncetotrueinscript-srcorstyle-srcdirectives and callingBepsvpt\SecureHeaders\SecureHeaders::nonce()to get nonce value.using inject
@inject('headers', 'Bepsvpt\SecureHeaders\SecureHeaders') <style nonce="{{ $headers->nonce() }}"> // your css </style>
or calling directly
<script nonce="{{ Bepsvpt\SecureHeaders\SecureHeaders::nonce() }}"> // your js </script>
If you want to run testing, make sure you have the corresponding package version and minimum php version.
| Laravel | Testbench | PHPUnit | Minimum PHP Version |
|---|---|---|---|
| 5.1 | 3.1 | 5.7 | 7.0 |
| 5.2 | 3.2 | 5.7 | 7.0 |
| 5.3 | 3.3 | 5.7 | 7.0 |
| 5.4 | 3.4 | 6.5 | 7.0 |
| 5.5 | 3.5 | 6.5 | 7.0 |
| 5.6 | 3.6 | 7.5 | 7.1.3 |
| 5.7 | 3.7 | 7.5 | 7.1.3 |
| 5.8 | 3.8 | 7.5 | 7.1.3 |