Skip to content

add support for appending no-cache to Cache-Control header #35720

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
anadimisra opened this issue Feb 14, 2020 · 0 comments · Fixed by #35748
Closed

add support for appending no-cache to Cache-Control header #35720

anadimisra opened this issue Feb 14, 2020 · 0 comments · Fixed by #35748

Comments

@anadimisra
Copy link

Description
While using Symphony in Laravel, we set response headers for GET requests through a middleware cache.headers

Route::resource('blogs', 'BlogPostController')->except('create','edit')->middleware('cache.headers:private;max_age=86400;etag');

If I add no_cache then it breaks the response, and I get the error

Response does not support the following options: "no-cache".

The error led me to following block of code in Symfony\Component\HttpFoundation

if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'])) {
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff)));
}

adding no_cache support will be really helpful.

@fabpot fabpot closed this as completed Apr 5, 2020
fabpot added a commit that referenced this issue Apr 5, 2020
…p control directives (azjezz)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpFoundation] Add support for all core response http control directives

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #35720
| License       | MIT
| Doc PR        | N/A

Add support for all core cache-control directives

see : https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

Commits
-------

011cd38 [HttpFoundation] Add support for all core http control directives
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants