Skip to content

Add standalone ChatGPT Sites mirror proxy (sites-proxy/) - #16

Closed
tonythethompson wants to merge 2 commits into
mainfrom
sites-proxy
Closed

Add standalone ChatGPT Sites mirror proxy (sites-proxy/)#16
tonythethompson wants to merge 2 commits into
mainfrom
sites-proxy

Conversation

@tonythethompson

@tonythethompson tonythethompson commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Additive, shippable revival of the abandoned codex/chatgpt-dev-proxy experiment: a ~40-line Cloudflare Worker that mirrors trackdub.com under a separate hostname (e.g. trackdub.dev) so OpenAI ChatGPT Sites can serve a copy of the marketing site.

Unlike the old branch — which replaced the app's package.json (wiping all scripts/deps) — this version lives entirely inside sites-proxy/ and touches no app files.

Files

File Purpose
sites-proxy/index.js The Worker: forwards path/query/method/body upstream, rewrites same-site redirects, preserves external ones, tags x-robots-tag: noindex + x-trackdub-mirror: chatgpt-sites
sites-proxy/proxy.test.mjs 6 unit tests, zero dependencies (node built-ins)
sites-proxy/build.mjs Emits dist/server/index.js relative to sites-proxy/ so wrangler resolves main correctly
sites-proxy/wrangler.jsonc Standalone deploy config (trackdub-dev-proxy worker)
sites-proxy/README.md Layout, test/build/deploy commands, config notes

Improvements over the experiment

  • Additive — app's package.json/wrangler.jsonc/source untouched
  • Env-configurable upstream (UPSTREAM_ORIGIN var, defaults to https://trackdub.com) with a dedicated test
  • Deployment config + README the experiment lacked

Verification

  • node --test sites-proxy/proxy.test.mjs6/6 pass
  • wrangler deploy --dry-run → uploads 1.96 KiB, no bindings
  • Repo-wide eslint . + tsc --noEmitgreen (no app files changed)

Notes

  • Deploy is intentionally NOT wired into CI — this is a manual, opt-in deploy for a mirror that may be temporary.
  • dist/ is already gitignored repo-wide.

Summary by cubic

Adds a tiny Cloudflare Worker in sites-proxy/ that mirrors trackdub.com under a separate hostname for ChatGPT Sites. It’s fully standalone and does not touch any app files.

  • New Features

    • Proxies path/query/method/body to the upstream and rewrites same-site redirects by origin (scheme+host+port) to the mirror; different-port and external redirects pass through. Prevents upstream ports from leaking onto mirror URLs.
    • Adds x-robots-tag: noindex, nofollow and x-trackdub-mirror: chatgpt-sites headers.
    • Upstream is configurable via UPSTREAM_ORIGIN (defaults to https://trackdub.com).
    • Includes wrangler.jsonc, a simple build.mjs emitting dist/server/index.js, and 9 tests using Node built-ins.
  • Migration

    • Optional manual deploy: npx wrangler deploy --config sites-proxy/wrangler.jsonc. No app changes required.

Written for commit d14131d. Summary will update on new commits.

Review in cubic

Note

Add Cloudflare Worker proxy that mirrors trackdub.com under an alternate hostname

  • Adds a new standalone sites-proxy/ package containing a Cloudflare Worker that forwards requests to a configurable upstream origin (defaulting to https://trackdub.com) while preserving path, query, method, and body.
  • Same-origin Location header redirects are rewritten to use the mirror hostname; redirects to external origins pass through unchanged.
  • Every response gets x-robots-tag: noindex, nofollow and x-trackdub-mirror: chatgpt-sites headers appended.
  • Includes a wrangler.jsonc config, a build.mjs script that copies the worker source to dist/server/index.js, and unit tests in proxy.test.mjs.

Macroscope summarized d14131d.

Additive version of the abandoned codex/chatgpt-dev-proxy experiment:
a ~40-line Cloudflare Worker that mirrors trackdub.com under a separate
hostname for ChatGPT Sites, without touching the app's package.json,
wrangler.jsonc, or any source.

- index.js: forwards path/query/method/body upstream, rewrites same-site
  redirects, preserves external ones, tags x-robots-tag: noindex + mirror
  header. Upstream origin is env-configurable (defaults to trackdub.com).
- proxy.test.mjs: 6 unit tests, zero dependencies (node built-ins only).
- build.mjs: emits dist/server/index.js relative to sites-proxy/ so
  wrangler resolves "main" correctly.
- wrangler.jsonc: standalone deploy config for the proxy worker.
- README.md: layout, test/build/deploy commands, config notes.

Verified: 6/6 tests pass, wrangler --dry-run uploads 1.96 KiB with no
bindings, repo-wide eslint + tsc stay green (no app files touched).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
trackdub-website d14131d Commit Preview URL

Branch Preview URL
Aug 07 2026, 11:42 AM

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tonythethompson, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 10 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a96fac6-a740-439c-8fdc-5834694776b2

📥 Commits

Reviewing files that changed from the base of the PR and between 6bd741f and d14131d.

📒 Files selected for processing (5)
  • sites-proxy/README.md
  • sites-proxy/build.mjs
  • sites-proxy/index.js
  • sites-proxy/proxy.test.mjs
  • sites-proxy/wrangler.jsonc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread sites-proxy/index.js Outdated
@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds a standalone Cloudflare Worker that mirrors the marketing site without modifying the primary application.

  • Proxies incoming requests to a configurable upstream origin.
  • Rewrites redirects matching the configured upstream origin while preserving external redirects.
  • Adds mirror-identification and search-engine exclusion headers.
  • Includes standalone build, deployment, documentation, and unit-test files.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
sites-proxy/index.js Implements request forwarding, exact-origin redirect matching, downstream authority rewriting, and mirror response headers; the follow-up port fixes appear complete.
sites-proxy/proxy.test.mjs Covers forwarding, environment configuration, response tagging, external redirects, bare/www. matching, and the corrected non-default-port behavior.
sites-proxy/build.mjs Builds the standalone worker by copying its entry point into the Wrangler-configured output path.
sites-proxy/wrangler.jsonc Defines the independent Worker deployment, output entry point, compatibility date, observability, and optional upstream configuration.
sites-proxy/README.md Documents the mirror’s behavior, standalone layout, commands, configuration, and redirect policy.

Reviews (2): Last reviewed commit: "fix: compare full origin when rewriting ..." | Re-trigger Greptile

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 7, 2026
Comment thread sites-proxy/README.md
# trackdub-dev-proxy

A tiny Cloudflare Worker that mirrors **trackdub.com** under a separate
hostname (e.g. `trackdub.dev`) so external platforms — such as OpenAI

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Em dashes in user-facing prose

Lines 4, 5, and 54 use em dashes () in user-facing prose. Replace with standard dashes or rephrase to comply with the style guide.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • sites-proxy/index.js
  • sites-proxy/proxy.test.mjs
Previous Review Summary (commit 11a1161)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 11a1161)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
sites-proxy/README.md 4 Em dashes () in user-facing prose on lines 4, 5, and 54. Replace with standard dashes or rephrase to comply with the style guide.
Files Reviewed (5 files)
  • sites-proxy/README.md - 1 issue
  • sites-proxy/index.js
  • sites-proxy/proxy.test.mjs
  • sites-proxy/build.mjs
  • sites-proxy/wrangler.jsonc

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash · Input: 42.6K · Output: 11.2K · Cached: 466K

Review guidance: REVIEW.md from base branch main

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Confidence score: 3/5

  • In sites-proxy/index.js, forwarding all incoming headers and relaying upstream Set-Cookie values unchanged between different domains can expose Cookie/Authorization data and create broken or unsafe session behavior for mirror visitors; restrict forwarded headers to an allowlist and sanitize or rewrite/drop Set-Cookie before returning it.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="sites-proxy/index.js">

<violation number="1" location="sites-proxy/index.js:24">
P2: The worker forwards every incoming header (including `Cookie`/`Authorization`) to the upstream and passes the upstream's `Set-Cookie` back unmodified to mirror visitors. Since the mirror and `trackdub.com` are different origins, this lets each side read/write the other's cookies through the proxy — a visitor's mirror cookies are sent to the canonical site, and any cookie the upstream sets ends up stored and re-sent under the mirror host. For a public marketing mirror this is low impact today, but it becomes a cross-origin session-leak if either endpoint ever carries auth or if ChatGPT Sites' requests include credentials. Consider stripping `cookie`/`authorization` from the upstream request and filtering `set-cookie` (or namespacing/overriding the `Domain`) on the response for this unauthenticated mirror.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread sites-proxy/index.js Outdated
Comment thread sites-proxy/index.js
) {
const downstreamUrl = new URL(request.url);
const upstreamUrl = new URL(downstreamUrl.pathname + downstreamUrl.search, upstreamOrigin);
const upstreamRequest = new Request(upstreamUrl, request);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The worker forwards every incoming header (including Cookie/Authorization) to the upstream and passes the upstream's Set-Cookie back unmodified to mirror visitors. Since the mirror and trackdub.com are different origins, this lets each side read/write the other's cookies through the proxy — a visitor's mirror cookies are sent to the canonical site, and any cookie the upstream sets ends up stored and re-sent under the mirror host. For a public marketing mirror this is low impact today, but it becomes a cross-origin session-leak if either endpoint ever carries auth or if ChatGPT Sites' requests include credentials. Consider stripping cookie/authorization from the upstream request and filtering set-cookie (or namespacing/overriding the Domain) on the response for this unauthenticated mirror.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At sites-proxy/index.js, line 24:

<comment>The worker forwards every incoming header (including `Cookie`/`Authorization`) to the upstream and passes the upstream's `Set-Cookie` back unmodified to mirror visitors. Since the mirror and `trackdub.com` are different origins, this lets each side read/write the other's cookies through the proxy — a visitor's mirror cookies are sent to the canonical site, and any cookie the upstream sets ends up stored and re-sent under the mirror host. For a public marketing mirror this is low impact today, but it becomes a cross-origin session-leak if either endpoint ever carries auth or if ChatGPT Sites' requests include credentials. Consider stripping `cookie`/`authorization` from the upstream request and filtering `set-cookie` (or namespacing/overriding the `Domain`) on the response for this unauthenticated mirror.</comment>

<file context>
@@ -0,0 +1,53 @@
+) {
+  const downstreamUrl = new URL(request.url);
+  const upstreamUrl = new URL(downstreamUrl.pathname + downstreamUrl.search, upstreamOrigin);
+  const upstreamRequest = new Request(upstreamUrl, request);
+  const upstreamResponse = await fetchImpl(upstreamRequest, { redirect: "manual" });
+  const headers = new Headers(upstreamResponse.headers);
</file context>

Comment thread sites-proxy/index.js Outdated
Match Location rewrites by origin (including port), leave different-port redirects alone, and copy hostname/port separately so an upstream port cannot stick on the mirror URL.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps
greptile-apps Bot dismissed their stale review August 7, 2026 11:42

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@tonythethompson

Copy link
Copy Markdown
Contributor Author

Closing as not-planned — the proxy has no consumer in ChatGPT Sites.

Primary-source research (OpenAI's own help center — "Creating and managing
ChatGPT Sites") showed ChatGPT Sites is a generative builder: you give it
a prompt and content, it builds and hosts the site on OpenAI's runtime
(*.openai.chatgpt.site or your own domain via DNS). It never fetches an
external origin, so a reverse-proxy mirror of trackdub.com has no mechanism
to be consumed by Sites. Custom domains work in reverse: you point DNS at
OpenAI, not at your own server.

The supported route is documented in docs/chatgpt-sites-plan.md (PR #18):
paste the real site copy into an @Sites prompt, then connect a subdomain
via the Add-domain flow. This proxy's code (6/6 tests passing, 1.96 KiB
deploy) is preserved for potential non-Sites uses (e.g. a staging mirror),
but is not being shipped.

@tonythethompson
tonythethompson deleted the sites-proxy branch August 7, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant