Skip to content

chore(dev): allow https://mm-dev.yeraze.online as a CORS origin - #4500

Merged
Yeraze merged 1 commit into
mainfrom
chore/allowed-origins-mm-dev
Aug 2, 2026
Merged

chore(dev): allow https://mm-dev.yeraze.online as a CORS origin#4500
Yeraze merged 1 commit into
mainfrom
chore/allowed-origins-mm-dev

Conversation

@Yeraze

@Yeraze Yeraze commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Adds https://mm-dev.yeraze.online to ALLOWED_ORIGINS in docker-compose.dev.yml, across all three profiles (sqlite, postgres, mysql) so it survives a backend switch — alongside the sentry / spire / meshdev.yeraze.online entries already there.

Origin only, no path

The request was for https://mm-dev.yeraze.online/meshmonitor/, but the value has to be the bare origin. The check is:

allowedOrigins.includes(origin)

an exact string match against the browser's Origin header — which is scheme + host + port and never carries a path. A value ending in /meshmonitor/ could not match anything. That prefix is already handled by BASE_URL=/meshmonitor.

Verified against the running server rather than assumed:

Origin sent result
https://mm-dev.yeraze.online ✅ echoed in Access-Control-Allow-Origin
https://mm-dev.yeraze.online/meshmonitor/ ❌ rejected
https://evil.example.com ❌ rejected (control)

Note for anyone editing origins later

.env also defines ALLOWED_ORIGINS, but it is inert for these services: Compose's environment: block overrides env_file:, and all three services set the variable inline. Editing .env to change origins will appear to do nothing.

Config-only change — no application code touched.


Generated by Claude Code

Adds the mm-dev hostname to ALLOWED_ORIGINS across all three dev-compose
profiles (sqlite, postgres, mysql) so it survives a backend switch, alongside
the sentry/spire/meshdev entries already there.

Origin only, no path. The check is `allowedOrigins.includes(origin)`, an
exact match against the browser's Origin header — which is scheme + host +
port and never carries a path, so a value ending in `/meshmonitor/` could
never match. That prefix is already handled by BASE_URL.

Verified against the running server: the bare origin comes back in
Access-Control-Allow-Origin, while the path-suffixed form and an unrelated
origin are both rejected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9NzRtqE8eSMS8tvAeodUB
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

Claude finished @Yeraze's task —— View job


PR Review

  • Gather context and read changed files
  • Analyze changes and provide review feedback

Summary

Config-only change adding https://mm-dev.yeraze.online to ALLOWED_ORIGINS across all three Compose profiles. The change is straightforward and the PR description explains the reasoning well.

Review

Correctness ✅

The bare-origin approach is correct. The Origin header is always scheme+host+port — no path — so using https://mm-dev.yeraze.online (not https://mm-dev.yeraze.online/meshmonitor/) is the only form that can match.

Consistency observation ⚠️

The three profiles have slightly different origin sets, and this PR doesn't fully align them. After this PR:

Origin sqlite (line 123) postgres (line 75) mysql (line 192)
http://sentry.yeraze.online:8081
http://spire.yeraze.online:8081
https://meshdev.yeraze.online
https://mm-dev.yeraze.online

The spire.yeraze.online:8081 entry is already present in the sqlite profile but missing from postgres and mysql — that pre-existing asymmetry exists before this PR and is out of scope here, but worth noting for a future cleanup.

Security note ℹ️

This is a dev compose file only, not production config, so the personal domain entries are expected and appropriate. The .env override caveat documented in the PR description (Compose environment: takes precedence over env_file:) is a useful note and accurately reflects Express/Compose behavior.

No issues blocking merge. The change does exactly what it says, in the right format, across all three profiles.


@Yeraze
Yeraze merged commit 629bfb2 into main Aug 2, 2026
15 checks passed
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