batch.com/headers-bundle

A Symfony bundle to easily add headers to your responses.

Installs: 694

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 1

Open Issues: 0

Type:symfony-bundle

1.0.0 2020-10-15 14:42 UTC

This package is auto-updated.

Last update: 2021-04-19 15:52:25 UTC


README

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:

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

$ composer require batch.com/headers-bundle

Read the documentation for complete instructions.

Documentation

Read the documentation in src/Resources/doc/