https://github.com/batchlabs/headers-bundle
A Symfony bundle to easily add headers to your responses.
https://github.com/batchlabs/headers-bundle
headers http symfony symfony-bundle
Last synced: 3 months ago
JSON representation
A Symfony bundle to easily add headers to your responses.
- Host: GitHub
- URL: https://github.com/batchlabs/headers-bundle
- Owner: BatchLabs
- License: mit
- Created: 2020-09-21T16:12:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-04T00:09:37.000Z (about 2 years ago)
- Last Synced: 2025-10-09T13:45:01.304Z (6 months ago)
- Topics: headers, http, symfony, symfony-bundle
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Batch Headers Bundle
A Symfony bundle to ease the configuration of global response headers. Instead of creating a response listener to add custom headers, use a configuration file:
```yaml
batch_headers:
headers:
# Apply a CSP on all the responses
- Content-Security-Policy: default-src 'self'
# Allow your API to be requested from all origins
- name: Access-Control-Allow-Origin
value: "*"
condition: request.getPathInfo() matches '^/api'
# Always cache images
- name: Cache-Control
value: max-age=31536000, public
condition: response.headers.get('Content-Type') matches '^image/'
```
## Installation
```console
$ composer require batch.com/headers-bundle
```
Read the documentation for complete instructions.
## Documentation
Read the documentation in [src/Resources/doc/](src/Resources/doc/index.md)