batch.com /headers-bundle

一个用于轻松添加响应头的 Symfony 扩展包。

安装数量: 43,460

依赖关系: 0

建议者: 0

安全性: 0

星标: 0

关注者: 7

分支: 4

开放问题: 2

类型:symfony-bundle

2.0.0 2022-08-29 14:48 UTC

This package is auto-updated.

Last update: 2024-08-29 05:31:11 UTC


README

一个用于简化全局响应头配置的 Symfony 扩展包。无需创建响应监听器来添加自定义头,而是使用配置文件

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/'

安装

$ composer require batch.com/headers-bundle

阅读文档以获取完整说明。

文档

src/Resources/doc/ 阅读文档