After logging in, the page is stored in a shared cache, and how should the private and non-cacheable headers in the cache header be written.

📅 2026-10-11 👁️ 11

The page logged in is stored in a shared cache, and the problem is usually that the cache header is not written completely. According to MDN's definition, no-store means that any type of cache (private or shared) should not store the response; private means that the response can only be stored in private cache, that is, the browser's local cache. The difference between the two is not 'how long the cache is', but 'who is allowed to store'.'Pages with login status only write expiration time without writing ownership, and the shared cache may reuse that response for other users later.'

Who are the two types of caches?

Private cache is located on the user's side, typically in the browser's local cache, naturally isolated by users, and personalized content stored there usually does not constitute a leak.

Shared cache is located between the source site and the client, such as reverse proxy and CDN nodes. The MDN description is clear: it stores one response and resues it for multiple users. This is the source of risk - shared cache does not understand the login state; it only judges whether it is the same request based on the cache key.

There is a type that is often overlooked: the response cache within the application and the staticized products of the page. Their nature is between the two, depending on whether the generation time includes the user identity. Any cache that knows the current user at the time of generation and no longer distinguishes between users at the time of output should be treated as shared cache.

The meanings of 'not stored' and 'private' are distinct.

The applicable boundaries of the two should be clarified; getting it wrong is more麻烦 than not writing it at all.

directive semantics Applicable objects Consequences of misuse
no-store No cache may store this response Pages containing credentials, transactions, and personal data With it, performance optimization is completely out of the question
private Store privately Pages that vary per person but are not sensitive If the downstream still uses strong caching, it is equivalent to not being effective
Public + Expiration Time Allow shared caching Public content unrelated to identity Personalized page errors will cause conflicts for users

The order of choice is recommended to ask this way: Is there any information that belongs only to the current user in this response? If there is and it cannot be tolerated being read by others, use no-store. If the content varies from person to person but is not very sensitive, and caching can bring obvious benefits, use private. If it is unrelated to identity, it can enter the shared cache.

A common misconception is that 'private' will make the CDN not cache. A more accurate statement is that 'private' is a request for shared caches not to store it, but some intermediate layer behaviors do not completely adhere to this semantics. Therefore, 'no-store' is a more deterministic way of writing for truly sensitive responses.

Why is the member grouping page more likely to have problems?

The system supports user management and VIP groups, and can set access permissions for different user groups. Once this layered capability meets caching, it will form a typical page problem: The same address returns different content due to different user groups of the logged-in user, but this difference is not reflected in the cache key.

Three types of pages are most likely to be overlooked. The first is the member area entrance displayed after login, where different groups see different content; the second is the pages related to price, ordering, and orders, where permissions determine the visible range; the third is the pages for downloading or attachments, where permission verification is at the application layer, and once the response enters the shared cache, subsequent visits no longer trigger verification.

The third type is particularly dangerous: it gives people the illusion that 'I have done permission judgment in my program, so it is safe'. But the cache skips the program, and the permission judgment is not executed at all.

The standard for judgment should be whether the response is different for each person, not whether the page is important. Any response that has read the user's identity, group, or permission during rendering is automatically excluded from the shared cache, and sub-resources unrelated to identity can be opened separately as needed.

Side effects on reverse proxy and acceleration nodes

Adding another layer of cache on the link adds another risk, because the rules are scattered in two places: the application writes the response header, and the intermediate layer decides whether to follow its own strategy. When deploying the site, if there are both reverse proxy and acceleration nodes at the same time, these two layers should be checked together, and simply adjusting the application side is often not enough.

To verify four things. First, does the intermediate layer have a mandatory caching strategy. Some configurations will override upstream instructions, making the application side useless. Second, when the cache is hit, is the response header rewritten. If the header information is lost after caching, the client cannot see that this content comes from the cache. Third, is the old response in the cache still there after logging out. The login state change does not automatically invalidate the objects in the shared cache. Fourth, whether the staticized products are classified by user directory. Writing the login page as a static file is the most difficult to find in the same category of problems.

Three-step self-check

Step 1, access the same address with two different accounts to compare whether the response is really different. If the second visit gets the content of the first visit, it means that a shared cache that should not have been hit has been hit.

Step 2, look at the ownership statement and cache identifier in the response header to confirm which layer the response has been stored at. Responses missing the statement should be supplemented, and login state responses with cache hit traces should be handled immediately.

Step 3, check the logout login path. Reliable implementation should make the jump address after login not enter the shared cache, rather than relying on the client-side cleanup.

Common questions

Is it okay to add no-store to the entire site?Technically feasible, but it will sacrifice the caching benefits of public content, with the site load increasing significantly. It should be differentiated by response type rather than a global cut-off.

Is it enough just to add it to the login interface?Not enough. The problem lies in the page response rendered in the logged-in state, the interface is only part of it.

Will the private on CDN take effect?The behaviors of different implementations are not completely consistent, and sensitive responses should use no-store more reliably. It should be verified on a real node before going online rather than depending on documentation descriptions.

How can staticization be made safe?Pages unrelated to identity should be staticized; member-related content should be dynamically rendered based on permissions, or the differences should be converged into small areas that are not cached.

How to determine if there are any residual historical responses?Observe whether old content can still be accessed after logging out, or check the existence time of objects in the cache layer. When residuals are found, close the cache of the path first, and then investigate the generation logic.

Related articles

Writing the type header of the upload directory correctly is not enough; why do we need to add a separate response header to prohibit content sniffing?

MDN document states that X-Content-Type-Options indicates that the type declared in Content-Type should be followed and not changed, nosniff will block the response when the type requested in scripts or styles does not match. This article explains where sniffing occurs, why the upload directory needs to be blocked again at the deployment layer, and what each layer manages within the site.

2026-10-11

To enable HTTP/3 on a web server, you need to adjust the port, certificate, and compilation options.

The Nginx official module document states that ngx_http_v3_module has provided experimental HTTP/3 support since version 1.25.0 and is not compiled by default. It requires --with-http_v3_module to enable, the example listening port is recommended to be consistent with HTTPS, and 0-RTT requires OpenSSL 3.5.1 or higher. This article explains the enablement sequence in four steps: compiling, listening, certificate, and library version.

2026-10-11

When the open source agreement is written as GPL, what should be noted when modifying and delivering to the customer.

Based on the official WordPress authorization page, the requirements of GPLv2 or later versions cover derived works, plugins and themes are considered derived works by the official, and there is a legal gray area. This article explains the three things to be delivered to the outside world, the boundary between multi-site and secondary development, as well as the authorization verification sequence at the selection stage.

2026-10-11

The pictures on the list page are replaced with a new generation of compression format, will the volume and crawling change together?

The compression readout given in the official document is: The new lossy format is about 50% smaller than JPEG on average, another common format is about 25%—35% smaller on average, and the lossless scenario is about 26% smaller; at the same time, it is explicitly recommended to retain the fallback format. This article explains that the volume will decrease after changing the format, but what is read depends on the image list and alternative text, and the order of implementation on the site is given.

2026-10-11

Why would a translation be sent to someone in another language if the site negotiated the language in the request header and cached it?

The MDN Vary document specifies that this response header describes the method of request information that affects the response content outside of the URL, including Vary to ensure that the response is cached based on the listed header fields separately. The most common use is to construct a cache key during content negotiation. This article explains the cause of the translation string given to other visitors, how to declare the response, and the differences in the two methods of language arrangement.

2026-10-11

Why returning a 503 when the site is upgraded and maintenance page is displayed is more reliable than returning a blank page

The MDN 503 document states that this status code indicates that the server is not ready to handle the request, common reasons include maintenance or overload, the response should only be used for temporary conditions and should ideally include the Retry-After header with the expected recovery time; the document also hints that 503 indicates a temporary issue and should not be cached. This article explains how to configure the status code, retry time, and caching during the maintenance window.

2026-10-11

The page actually exists but always returns 404, what impact will it have on indexing?

The content is still in the library, but the front-end has deemed the page non-existent. The signal received by the search engine is that the resource has disappeared, and the inclusion and traffic will follow suit. This article explains why a unified error code is dangerous, the several cases of status codes being semantically分流, and the troubleshooting sequence of document status, pseudo-static rules, redirection, and site map configuration.

2026-10-11

The redirect address after successful login is brought by parameters, and if not verified, it may be used for what.

The login redirect parameter is an external controllable input. When no centralized verification is performed, a legitimate login process may be transformed into a bridge from a trusted domain to a phishing page. This article explains what such redirect addresses are used for, what types of values the whitelist should block, and the division of labor of captcha and frequency control on the login path.

2026-10-11