Skip to content

Allow CORS from https://www.xmoj.tech#59

Merged
PythonSmall-Q merged 2 commits intomasterfrom
copilot/allow-cors-from-xmoj-tech
Mar 19, 2026
Merged

Allow CORS from https://www.xmoj.tech#59
PythonSmall-Q merged 2 commits intomasterfrom
copilot/allow-cors-from-xmoj-tech

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

The XMOJ main site (https://www.xmoj.tech) was not in the allowed CORS origins list, causing cross-origin requests from it to be rejected.

Changes

  • Source/index.ts: Added https://www.xmoj.tech as an exact-match allowed origin in getAllowedOrigin, covering both preflight OPTIONS responses and regular response headers.
const getAllowedOrigin = (origin: string): string | null => {
  // ...existing patterns...
  if (origin === "https://www.xmoj.tech") {
    return origin;
  }
  return null;
};

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • registry.npmmirror.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/_temp/ghcca-node/node/bin/npm install --ignore-scripts (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.


Summary by cubic

Allow cross-origin requests from https://www.xmoj.tech to our API. This lets the xmoj.tech frontend call our endpoints from the browser.

  • New Features
    • Whitelisted https://www.xmoj.tech in CORS via getAllowedOrigin.
    • CORS remains disabled for other origins.

Written for commit 8d5c15b. Summary will update on new commits.

Co-authored-by: PythonSmall-Q <106425289+PythonSmall-Q@users.noreply.github.com>
@PythonSmall-Q PythonSmall-Q marked this pull request as ready for review March 19, 2026 12:05
Copilot AI review requested due to automatic review settings March 19, 2026 12:05
Copilot AI changed the title [WIP] Add CORS support for https://www.xmoj.tech Allow CORS from https://www.xmoj.tech Mar 19, 2026
Copilot AI requested a review from PythonSmall-Q March 19, 2026 12:05
@PythonSmall-Q PythonSmall-Q merged commit 44ceeeb into master Mar 19, 2026
7 checks passed
@PythonSmall-Q PythonSmall-Q deleted the copilot/allow-cors-from-xmoj-tech branch March 19, 2026 12:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Cloudflare Worker entrypoint CORS allowlist to permit browser requests from https://www.xmoj.tech, enabling the xmoj.tech frontend to call the API cross-origin.

Changes:

  • Add https://www.xmoj.tech as an explicitly allowed origin in getAllowedOrigin.
  • CORS behavior remains deny-by-default for all other origins.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

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

Choose a reason for hiding this comment

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

No issues found across 1 file

Copilot stopped work on behalf of PythonSmall-Q due to an error March 19, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants