
A browser set to Chinese opens an English page, while the same URL returns Chinese through another CDN edge. Send two requests with different Accept-Language headers to the origin, then repeat them through the CDN. If the origin returns the right language for each request and the edge keeps serving one version, check the response's Vary header and the CDN's cache key.
Find out how the site picks a language
Accept-Language lists the client's preferred languages. A header such as zh-CN,zh;q=0.9,en;q=0.5 gives Chinese for mainland China the highest weight, followed by general Chinese and then English. Check whether a language in the URL, a visitor's explicit choice, or an account setting takes precedence. Test the URL and session state that actually exercise header-based negotiation. RFC 9110, Accept-Language
When the origin uses Accept-Language to select a representation for the same URL, it should send Vary: Accept-Language on the relevant responses. An HTTP cache uses the fields named in Vary to decide whether a saved response matches a later request. Compare Content-Language, the HTML document's lang attribute, and the visible text. The header describes the intended audience, while the HTML and text can reveal a template or translation issue. RFC 9110, Content-Language · RFC 9110, Vary · RFC 9111, cache matching
Compare two responses for the same URL
Use a public test page on a site you manage, with clearly different Chinese and English text. Make both GET requests from the same test location. Keep the URL and other request settings the same and confirm the edge location in the CDN logs. Replace url with your test page. The commands save the headers and bodies separately. If the response redirects, compare the Location values before checking the destination pages.
url='https://www.example.com/docs/' curl -sS --max-time 15 \ -H 'Accept-Language: zh-CN' \ -D zh.headers -o zh.html "$url" curl -sS --max-time 15 \ -H 'Accept-Language: en-US' \ -D en.headers -o en.html "$url" grep -Ei '^(HTTP/|content-language:|vary:|age:|location:|cache-status:|x-cache:|cf-cache-status:)' \ zh.headers en.headers
Repeat the pair through an internal origin test endpoint that preserves the site's routing. Compare the page content, Content-Language, Vary, and cache status. Check the origin logs for the header it received and the language it selected. Where cache headers are missing or unclear, use the CDN logs to establish whether the request reached the origin.
If the origin itself selects the wrong language, inspect the application's language precedence and fallback.
If the origin returns both languages correctly but the edge serves the same language on cache hits, check how the CDN matches cached variants.
If a request reaches the origin without
Accept-Language, check the forwarding policy. Apply the same comparison to cached language redirects.
Check forwarding and the cache key separately
Find the CDN rule that matched the URL. Forwarding Accept-Language lets the origin use it on a cache miss. The CDN also needs a way to distinguish the resulting variants on a cache hit. In CloudFront, for example, an origin request policy can forward a header independently of the cache policy that controls the cache key. Check both settings on the relevant cache behavior. CloudFront, origin request policies
Sites with a small set of public translations can give each language its own path, such as /zh/ and /en/. If an entry URL still redirects visitors according to their language preferences, review the caching rules for that redirect. Check shared-cache permissions and isolation separately for responses that rely on a visitor's session or account.
If the same URL needs to serve several languages, group requests by the supported language the origin will actually return. Use the same selection and fallback rules at the edge and origin. For example, group en-US and en-GB only if the site serves the same version to both. Using the full header value as a cache key can create separate entries for equivalent preferences with different ordering or weights. CloudFront, cache key examples
Verify both languages on cache hits
Apply the change to a test path and invalidate its affected cache entries. Request each language once to populate the cache, then alternate between them and confirm that cache hits still serve the expected page or redirect. Try an unsupported language to verify the default fallback, then repeat the check from an edge location that previously served the wrong version.
References checked on December 3, 2026.