batch.com/headers-bundle

A Symfony bundle to easily add headers to your responses.

Installs: 40 400

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 7

Forks: 3

Open Issues: 0

Type:symfony-bundle

2.0.0 2022-08-29 14:48 UTC

This package is auto-updated.

Last update: 2024-02-29 03: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/