Skip to content
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

Requests with Authorization header should not be cached according to HTTP Caching RFC #193

Open
iliayatsenko opened this issue Oct 19, 2024 · 0 comments

Comments

@iliayatsenko
Copy link

According to HTTP Caching RFC, requests containing Authorization header should not be cached, unless several special directives (must-revalidate, public and s-maxage) explicitly allow it.

And in current implementation request containing Authoirization header is cached despite the response contains header Cache-Control with value max-age=7200 (no directives allowing caching of authenticated requests).

Middleware configuration:

$handler->push(
    new CacheMiddleware(
        new PublicCacheStrategy(
            new DoctrineCacheStorage(
                DoctrineProvider::wrap(
                    new FilesystemAdapter('http_cache', 0, $cacheDir)
                )
            )
        )
    ),
    'http_cache'
);

Request headers:

Authorization: Bearer .....

Response headers:

Cache-control: max-age=7200

Possibly, implementation should be adjusted to RFC, or this discrepancy should be documented.
Thanks a lot.

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

No branches or pull requests

1 participant