An open API service indexing awesome lists of open source software.

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.

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)