Skip to content

ResponseCacheManager Ignores Cache-Control With Multiple Values #3431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danielshiplett opened this issue Jun 14, 2024 · 1 comment
Closed

Comments

@danielshiplett
Copy link

danielshiplett commented Jun 14, 2024

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.

@spencergibb
Copy link
Member

closing in favor of #3432

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants