openai / openai/codex

ChatGPT Sites deployment drops Cloudflare Workers Caching (`cache.enabled=true`)

Open
#43,611 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug codex-web
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What issue are you seeing?

Title:
ChatGPT Sites deployment drops Cloudflare Workers Caching (cache.enabled=true)

Summary

A Vinext/Cloudflare Vite build correctly generates a Worker deployment config with:

"cache": {
"enabled": true
}

in:

dist/server/wrangler.json

However, after the same project is deployed through ChatGPT Sites, Workers Caching does not appear to be enabled for the deployed Worker.

The Worker response itself is deployed correctly and returns the intended CDN cache headers, but the HTML responses never receive a CF-Cache-Status header and still incur Worker cold-start latency.

Static assets on the exact same Site do return CF-Cache-Status: HIT, so this does not appear to be a global header-filtering issue.

Environment

  • ChatGPT Sites
  • Vinext: 0.0.50
  • Vite: 8.0.13
  • @cloudflare/vite-plugin: 1.37.1
  • Wrangler: 4.92.0
  • React: 19.2.6
  • react-server-dom-webpack: 19.2.6
  • Public Site:
    https://langorvej-91-145.allan-petersen.chatgpt.site
  • Source repository:
    AllanPetersenDK/langorvej-91-145-site
  • Reproduced source commit:
    459fc50d7986425a5ca19be1bce4075093dc63f1

Build configuration

The Cloudflare Vite configuration contains:

const localBindingConfig = {
main: "./worker/index.ts",
compatibility_flags: ["nodejs_compat"],
cache: { enabled: true },
...
};

The production build generates:

dist/server/wrangler.json

with:

"main": "index.js",
"compatibility_date": "2026-05-15",
"compatibility_flags": ["nodejs_compat"],
"cache": {
"enabled": true
}

and:

.wrangler/deploy/config.json

contains:

{
"configPath": "../../dist/server/wrangler.json",
"auxiliaryWorkers": []
}

So the Cloudflare/Vite build output itself contains the requested Workers Caching setting.

Reproduction

  1. Build the project with:

    npm run build

  2. Verify the generated Worker config:

    python3 - <<'PY'
    import json
    from pathlib import Path

    data = json.loads(
    Path("dist/server/wrangler.json").read_text()
    )

    print(data.get("cache"))
    PY

Expected result:

{'enabled': True}

  1. Deploy the project using ChatGPT Sites.

  2. Request the public HTML repeatedly:

    curl -sS -D - -o /dev/null
    https://langorvej-91-145.allan-petersen.chatgpt.site/

The Worker correctly returns:

cache-control: public, max-age=0, must-revalidate
cdn-cache-control: public, max-age=300, stale-while-revalidate=60
cloudflare-cdn-cache-control: public, max-age=300, stale-while-revalidate=60

But there is no:

cf-cache-status
age

on any HTML response.

The same is true for:

/foreningsviden

Control test

A static CSS asset from the same deployment:

/assets/index-BS5-nTp5.css

returns consistently:

cf-cache-status: HIT

Example:

HTTP=200
content-type: text/css
cf-cache-status: HIT
cache-control: public, max-age=0, must-revalidate

This demonstrates that Cloudflare caching is present for static assets and that
CF-Cache-Status is not globally removed by the Sites frontend.

Actual behaviour

Dynamic HTML responses always execute through the Worker.

Cold requests have repeatedly shown first-byte latency around 2.1–2.6 seconds.

Examples:

/:
first request TTFB: 2.098 s
subsequent warm requests: approximately 0.08–0.10 s

Earlier measurement:

/:
first request TTFB: 2.522 s

A local production-like build of the same source normally renders:

/:
approximately 0.07–0.09 s TTFB

/foreningsviden:
approximately 0.04–0.06 s TTFB

This strongly suggests that the slow public request is Worker/runtime cold-start
latency rather than application rendering time.

Expected behaviour

If the generated Worker config contains:

"cache": {
"enabled": true
}

and ChatGPT Sites supports Cloudflare Workers Caching, the deployed Worker should
preserve that deployment property.

Cacheable anonymous HTML responses should then participate in Workers Caching,
with observable cache status such as MISS/HIT and without invoking the Worker for
a fresh cached response.

Observed behaviour

  • cache.enabled=true exists in the generated Cloudflare deployment config.
  • The application-level cache response headers reach production.
  • Static assets are cached by Cloudflare.
  • Dynamic Worker HTML never shows Workers Caching status.
  • Worker cold-start latency remains.

Suspected deployment boundary

@openai/sites-vite-plugin packages:

dist/.openai/hosting.json

and the documented Sites hosting metadata currently covers project/storage
bindings.

The generated Cloudflare Worker deployment metadata in:

dist/server/wrangler.json

may not be propagated completely when Sites creates the hosted Worker version.

Could you confirm whether ChatGPT Sites currently supports Cloudflare Workers
Caching (cache.enabled) for deployed Workers?

If it is supported, this appears to be a deployment bug where the generated
Worker cache setting is dropped.

If it is not currently supported, documenting that limitation would also be
helpful because the Cloudflare Vite build succeeds and produces a valid
cache.enabled=true deployment config, which makes the resulting behaviour look
as if the feature should survive deployment.

What steps can reproduce the bug?

See description

What is the expected behavior?

See description

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the generated dist/server/wrangler.json with the Sites metadata in dist/.openai/hosting.json and the .wrangler/deploy/config.json entry. First verify whether cache.enabled is propagated when ChatGPT Sites creates the hosted Worker, then redeploy and use the documented curl checks to confirm whether HTML responses gain CF-Cache-Status and age headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.