Skip to content

Commit c8efca2

Browse files
fix(docs): deploy on blog changes, correct GitHub repo, stop cross-locale homepage caching (#13)
Three fixes prompted by live-site issues: 1. deploy-docs.yml only triggered on content/docs/** — blog-only changes (like the expanded 'extend existing systems' post in #12) never deployed. Add content/blog/** to the path filter. 2. gitConfig.repo was 'spec' → the navbar GitHub link and the docs 'edit this page' link pointed at objectstack-ai/spec. Correct to objectstack-ai/objectos (where this content actually lives). 3. The prefix-less homepage ('/') is statically cached with s-maxage=31536000 and no Vary on Accept-Language. Its body, however, is language-negotiated by middleware — so a shared cache stored the English homepage at '/' and served it to every visitor, and non-English browsers stopped being redirected to their localized path. Mark the default-locale rewrite response 'private, no-cache' so the edge never shares it and middleware re-runs language detection per request. (Verified the redirect logic itself is correct: a cache-miss request with Accept-Language: zh-CN already 307s to /zh-Hans.) Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
1 parent 5a90708 commit c8efca2

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
paths:
77
- 'apps/docs/**'
88
- 'content/docs/**'
9+
- 'content/blog/**'
910
- 'pnpm-lock.yaml'
1011
- '.github/workflows/deploy-docs.yml'
1112
workflow_dispatch:

apps/docs/lib/layout.shared.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Image from 'next/image';
33

44
export const gitConfig = {
55
user: 'objectstack-ai',
6-
repo: 'spec',
6+
repo: 'objectos',
77
branch: 'main',
88
};
99

apps/docs/middleware.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,16 @@ export default function middleware(request: NextRequest) {
157157
const url = new URL(request.url);
158158
// Handle root path specially to avoid double slashes
159159
url.pathname = pathname === '/' ? `/${i18n.defaultLanguage}` : `/${i18n.defaultLanguage}${pathname}`;
160-
return NextResponse.rewrite(url);
160+
const response = NextResponse.rewrite(url);
161+
// This is a locale-negotiated response for a prefix-less path (e.g. "/").
162+
// The underlying page is statically cached with a long s-maxage, but the
163+
// *result here depends on the visitor's language* — so it must never be
164+
// stored in a shared cache, or the CDN would serve this (default-locale)
165+
// HTML to every visitor and non-English browsers would stop being
166+
// redirected to their localized path. Mark it private so the edge skips it
167+
// and middleware re-runs language detection on every request.
168+
response.headers.set('Cache-Control', 'private, no-cache, must-revalidate');
169+
return response;
161170
}
162171

163172
// For non-default languages, redirect to the localized path

0 commit comments

Comments
 (0)