Skip to content

Commit 7ba1c60

Browse files
committed
CORS proxy: Reduce /info/refs cache TTL to 5 min
- Was 12 hours, which caused stale clone data when repos got steady traffic
1 parent a090443 commit 7ba1c60

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cors-proxy/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ responses; otherwise just a pass-through proxy.
2424
`corsProxy`, so the proxy re-adds `https://` when the path doesn't start with `http`. Example:
2525
`https://proxy-host/github.com/foo/bar.git/info/refs` → upstream `https://github.com/foo/bar.git/info/refs`.
2626
- **Caching**: GET `/info/refs` v1 responses (no `Git-Protocol` header) are cached via the Cloudflare Cache API with a
27-
12-hour TTL (`Cache-Control: public, max-age=43200`). v2 responses are never cached — isomorphic-git uses v2 for
27+
5-minute TTL (`Cache-Control: public, max-age=300`). v2 responses are never cached — isomorphic-git uses v2 for
2828
branch detection then v1 for clone, and caching v2 would poison v1 lookups. `/info/refs` responses to the browser
2929
include `Cache-Control: no-store` so the browser doesn't cache them either (same v1/v2 concern). POST
3030
`/git-upload-pack` requests are never cached. The `X-Cache` response header indicates `HIT`, `MISS`, or `NONE` (for

cors-proxy/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ app.all('*', async (c) => {
309309
const cache = caches.default
310310
const cacheKey = new Request(targetUrl)
311311
const cacheHeaders = new Headers(responseHeaders)
312-
cacheHeaders.set('Cache-Control', 'public, max-age=43200')
312+
cacheHeaders.set('Cache-Control', 'public, max-age=300')
313313
const cacheResponse = new Response(response.clone().body, {
314314
status: response.status,
315315
headers: cacheHeaders,

0 commit comments

Comments
 (0)