Skip to content

feat(edge): blox.grudge-studio.com Worker custom domain - #19

Open
MolochDaGod wants to merge 1 commit into
mainfrom
feat/blox-edge-proxy
Open

feat(edge): blox.grudge-studio.com Worker custom domain#19
MolochDaGod wants to merge 1 commit into
mainfrom
feat/blox-edge-proxy

Conversation

@MolochDaGod

@MolochDaGod MolochDaGod commented Aug 29, 2026

Copy link
Copy Markdown
Owner

User description

Live Worker grudgeblox-edge-proxy binds custom domain blox.grudge-studio.com and proxies to https://grudgeblox.vercel.app. Same pattern as duelyst. Game WS stays on Railway; no player DB on this Worker.

Smoke: https://blox.grudge-studio.com/ and /play/test return 200 with X-Edge-Proxy: grudgeblox-edge-proxy.

Summary by Sourcery

Route GrudgeBlox web traffic through a dedicated edge proxy at blox.grudge-studio.com while leaving game WebSocket and data services unchanged.

New Features:

  • Add the blox.grudge-studio.com custom domain for GrudgeBlox through a Cloudflare Worker proxy to the Vercel application.

Enhancements:

  • Preserve upstream responses while identifying proxied traffic with the X-Edge-Proxy response header.

Deployment:

  • Configure the grudgeblox-edge-proxy Worker and bind it to the blox.grudge-studio.com custom domain.

CodeAnt-AI Description

Route GrudgeBlox web traffic through its dedicated custom domain

What Changed

  • GrudgeBlox is now available at blox.grudge-studio.com
  • Web requests are forwarded to the GrudgeBlox Vercel application while preserving request paths, query parameters, methods, and responses
  • Proxied responses identify the edge route with an X-Edge-Proxy header
  • Game WebSocket traffic and player data services remain on their existing platforms

Impact

✅ Dedicated GrudgeBlox web address
✅ Preserved page routes and request behavior
✅ Unchanged game and player data services

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Proxy https://blox.grudge-studio.com to grudgeblox.vercel.app. Same custom-domain pattern as duelyst. Game WS stays on Railway; no player DB on this Worker.
Copilot AI lite review requested due to automatic review settings August 29, 2026 08:56
@codeant-ai

codeant-ai Bot commented Aug 29, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 65bda67 Aug 29, 2026 · 08:56 09:03

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstore-grudge Ready Ready Preview Aug 29, 2026 8:58am

@codeant-ai

codeant-ai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@sourcery-ai

sourcery-ai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds and configures the grudgeblox-edge-proxy Cloudflare Worker, routing blox.grudge-studio.com requests to the Vercel GrudgeBlox origin while preserving request semantics and identifying proxied responses; game WebSockets and player data remain on their existing services.

Sequence diagram for GrudgeBlox custom-domain proxying

sequenceDiagram
    participant Client
    participant Worker as grudgeblox_edge_proxy
    participant Vercel as grudgeblox_vercel_app
    Client->>Worker: fetch(request)
    Worker->>Worker: new URL(request.url)
    Worker->>Vercel: fetch(target, method, headers, body)
    Vercel-->>Worker: upstream Response
    Worker->>Worker: set X-Edge-Proxy
    Worker-->>Client: Response(status, body, headers)
Loading

File-Level Changes

Change Details Files
Add a Cloudflare Worker that proxies the GrudgeBlox custom domain to its Vercel deployment.
  • Construct the upstream URL from the incoming path and query string.
  • Forward request headers while setting the upstream Host and original X-Forwarded-Host.
  • Preserve methods, request bodies, upstream status, and response headers with manual redirect handling.
  • Stamp responses with an X-Edge-Proxy identifier.
workers/blox-proxy/index.js
Configure deployment of the proxy Worker on the GrudgeBlox custom domain.
  • Define the Worker name, entrypoint, compatibility date, and account.
  • Bind blox.grudge-studio.com as a custom-domain route.
  • Document that WebSocket traffic and player data remain on Railway and the API.
workers/blox-proxy/wrangler.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Aug 29, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="workers/blox-proxy/index.js" line_range="15-27" />
<code_context>
+    const headers = new Headers(request.headers);
+    headers.set("Host", new URL(ORIGIN).host);
+    headers.set("X-Forwarded-Host", url.host);
+    const upstream = await fetch(
+      new Request(target, {
+        method: request.method,
+        headers,
+        body: request.method === "GET" || request.method === "HEAD" ? undefined : request.body,
+        redirect: "manual",
+      }),
+    );
+    const out = new Headers(upstream.headers);
+    out.set("X-Edge-Proxy", "grudgeblox-edge-proxy");
+    return new Response(upstream.body, { status: upstream.status, headers: out });
+  },
+};
</code_context>
<issue_to_address>
**issue (bug_risk):** If the upstream responds with HTTP 101 for a WebSocket upgrade, rebuilding it with `new Response(..., { status: upstream.status })` does not preserve the WebSocket response and can throw because the standard `Response` constructor does not accept status 101; the proxied connection therefore fails instead of upgrading.

**Triggers:** When any client sends a WebSocket upgrade through `blox.grudge-studio.com` rather than connecting directly to Railway.

**Suggested fix:** Return the upstream WebSocket response unchanged for status 101, or explicitly handle/reject WebSocket upgrades before forwarding them.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and this changes live DNS routing so requests to blox.grudge-studio.com depend on the Worker and the Vercel origin; a routing, forwarding, or origin failure could cause an outage or expose incorrect responses to users. Reverting restores the prior route, but any outage or externally visible failures occurring before the revert are not undone.

Blocking findings: workers/blox-proxy/index.js:27


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +15 to +27
const upstream = await fetch(
new Request(target, {
method: request.method,
headers,
body: request.method === "GET" || request.method === "HEAD" ? undefined : request.body,
redirect: "manual",
}),
);
const out = new Headers(upstream.headers);
out.set("X-Edge-Proxy", "grudgeblox-edge-proxy");
return new Response(upstream.body, { status: upstream.status, headers: out });
},
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): If the upstream responds with HTTP 101 for a WebSocket upgrade, rebuilding it with new Response(..., { status: upstream.status }) does not preserve the WebSocket response and can throw because the standard Response constructor does not accept status 101; the proxied connection therefore fails instead of upgrading.

Triggers: When any client sends a WebSocket upgrade through blox.grudge-studio.com rather than connecting directly to Railway.

Suggested fix: Return the upstream WebSocket response unchanged for status 101, or explicitly handle/reject WebSocket upgrades before forwarding them.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

A couple of config/runtime details (hard-coded account_id, and setting a forbidden Host header) should be corrected to align with repo conventions and avoid misleading behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a dedicated Cloudflare Worker edge proxy (grudgeblox-edge-proxy) to serve GrudgeBlox via the custom domain blox.grudge-studio.com, forwarding requests to the Vercel origin while tagging responses with X-Edge-Proxy.

Changes:

  • Introduce a new Worker with a custom-domain route for blox.grudge-studio.com.
  • Implement a simple pass-through proxy to https://grudgeblox.vercel.app that preserves method/path/query and adds an X-Edge-Proxy response header.
File summaries
File Description
workers/blox-proxy/wrangler.toml Defines the new grudgeblox-edge-proxy Worker and binds it to the blox.grudge-studio.com custom domain.
workers/blox-proxy/index.js Implements the request proxying behavior and adds the X-Edge-Proxy header to upstream responses.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +6 to +8
workers_dev = true
account_id = "ee475864561b02d4588180b8b9acf694"

Comment on lines +12 to +14
const headers = new Headers(request.headers);
headers.set("Host", new URL(ORIGIN).host);
headers.set("X-Forwarded-Host", url.host);
@augmentcode

augmentcode Bot commented Aug 29, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds a dedicated Cloudflare Worker for blox.grudge-studio.com.

Changes:

  • Proxies incoming HTTP requests to the GrudgeBlox Vercel deployment.
  • Preserves request method, headers, query string, and non-GET/HEAD bodies.
  • Marks upstream responses with X-Edge-Proxy: grudgeblox-edge-proxy.
  • Configures the Worker custom domain and Cloudflare account in Wrangler.
Technical Notes: The game WebSocket service remains on Railway; this Worker contains no player database integration.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

export default {
async fetch(request) {
const url = new URL(request.url);
const target = new URL(url.pathname + url.search, ORIGIN);

@augmentcode augmentcode Bot Aug 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

new URL() treats a pathname beginning with // as a scheme-relative URL, so a request such as https://blox.grudge-studio.com//attacker.example/path makes target point at attacker.example rather than ORIGIN. This turns the custom domain into an open proxy and forwards any blox cookies included with that request to the attacker-controlled target.

Severity: high

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants