Skip to content

ResponseCacheManager Ignores Cache-Control With Multiple Values #3431

@danielshiplett

Description

@danielshiplett

Describe the bug

The normal 'Cache-Control' header that is generated in a response by Spring WebMVC when configured to enable default cache controls contains the value "no-cache, no-store, max-age=0, must-revalidate". Spring Cloud Gateway's LocalResponseCache filtering mechanism doesn't check this value correctly and will apply default cache values to the response rather than skipping caching.

It also appears as if when a WebMVC explicitly specifies the max-age in its ResponseEntity, that Spring Cloud Gateway also ignores this value and uses its own.

Sample

I've created a sample repo with an application and Gateway that show this behavior.

https://github.com/danielshiplett/scg-error

I am also creating a PR that will show a possible fix. However, it caused several other tests to fail. This makes me think that either I am on the wrong track, or this was a major oversight that ended leading to invalid tests. Please let me know which.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions