netlogix/varnish-allowcookie

此包的最新版本(2.1.0)没有可用的许可证信息。

为配置的请求模式设置 'X-Allow-Cookie' 头。

2.1.0 2023-07-03 12:30 UTC

This package is auto-updated.

Last update: 2024-09-03 15:01:15 UTC


README

此包提供了一个HTTP中间件,用于为配置的请求模式设置一个 X-Allow-Cookie 头,该头将设置一个cookie。

当只有少数几个请求应该能够设置cookie时,这可能很有用。Varnish可以检查beresp是否包含一个Set-Cookie头,如果未设置X-Allow-Cookie,则将其删除。

安装

composer require netlogix/varnish-allowcookie

配置

允许的模式可以配置如下

Netlogix:
  Varnish:
    AllowCookie:
      allowedRequestPathPatterns:
        - '#^/neos#'
        - '#^/some/other/(request|uri)#'

/neos开头的请求将默认允许。

测试

当前测试需要在此包在Flow环境中安装。

FLOW_CONTEXT=Testing/Unit ./bin/phpunit -c Packages/Application/Netlogix.Varnish.AllowCookie/phpunit.xml.dist --testsuite="Unit" --bootstrap "Build/BuildEssentials/PhpUnit/UnitTestBootstrap.php"