Skip to content

Vary headers not taking effect if passed as Array in response object. #12118

@epicwhale

Description

@epicwhale

I am seeing a difference in caching behaviour between using $response->setVary(["Accept-Encoding", "X-Foo-A", "X-Foo-B"]); v/s using $response->setVary("Accept-Encoding, X-Foo-A, X-Foo-B");

The first one sends the correct Vary headers, but does not actually cache it.. if I try querying the same URL with a different value for one of the headers, it gives me the same cached response with a cache HIT instead of missing it. Basically the Vary header response seems to be sent, but is not taking an actual effect on the Caching rules.

BUT, the second one works as expected. Querying the same URL with a different value for one of the vary headers gives a Cache Miss.

I am using symfony's app cache for testing.

Notes on my setup:

  1. I am using Symfony's HTTP Cache Kernel
  2. I am using FOSRestBundle
  3. I am using Postman to create / inspect the response
  4. Using symfomy 2.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions