Skip to content

Cache tags not being added on redirect response. #286

Closed
@thisispaul

Description

@thisispaul

The X-Cache-Tags header is not being added to Redirect Responses and I think it should be. I have a service which generates screenshots based on some data and I need to cache the redirect to the file it generates and then invalidate when the data is updated. Tags seem to be the way to do this however the tags are not added on redirect responses.

The offending code is on line 70 TagSubscriber.php where it checks to see if the response is successful

        if ($response->isSuccessful()) {
            $tags = $this->getAnnotationTags($request);
        }

I'm proposing a simple change to this so it also tags redirect responses.

        if ($response->isSuccessful() || $response->isRedirection()) {
            $tags = $this->getAnnotationTags($request);
        }

Is there any reason this isn't like this already/a different way to get it to tag redirect response (HTTP Code 302).

I'm happy to submit a pull request if this is fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions