Skip to content

A Symfony bundle to easily add headers to your responses.

License

Notifications You must be signed in to change notification settings

BatchLabs/headers-bundle

Repository files navigation

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:

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/

About

A Symfony bundle to easily add headers to your responses.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages