batch.com/headers-bundle

A Symfony bundle to easily add headers to your responses.

Installs: 1 932

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 5

Forks: 1

Open Issues: 0

Type:symfony-bundle

1.1.1 2021-07-16 14:51 UTC

This package is auto-updated.

Last update: 2022-01-16 16:11:03 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/