X Tutup
Skip to content

feat: add regex support to trusted-origins#7697

Open
abdulsattar wants to merge 1 commit intocoder:mainfrom
abdulsattar:feat/trusted-origins-regex
Open

feat: add regex support to trusted-origins#7697
abdulsattar wants to merge 1 commit intocoder:mainfrom
abdulsattar:feat/trusted-origins-regex

Conversation

@abdulsattar
Copy link

Summary

Adds regex support for --trusted-origins. Entries can be exact host strings, *, or regex literals in the form /pattern/flags (e.g. /^.*\.example\.com$/i).

Changes

  • Add isTrustedOrigin() helper that matches exact strings, *, or regex literals /pattern/flags. Invalid regex entries are treated as non-matching.
  • Use isTrustedOrigin in authenticateOrigin() for --trusted-origins (VS Code WebSocket and path/domain proxy).
  • Add unit tests for isTrustedOrigin and for regex/wildcard in the origin auth flow.

Use case

Useful when code-server is behind a wildcard subdomain (e.g. --trusted-origins '/\.your-domain\.com$/') so you don't have to list every subdomain explicitly.

Made with Cursor

- Add isTrustedOrigin() helper that matches exact strings, '*', or regex
  literals in the form /pattern/flags (e.g. /^.*\.example\.com$/i)
- Use isTrustedOrigin in authenticateOrigin() for --trusted-origins
- Add unit tests for isTrustedOrigin and for regex/wildcard in origin auth

Made-with: Cursor
@abdulsattar abdulsattar requested a review from a team as a code owner March 9, 2026 18:53
@abdulsattar
Copy link
Author

Apologies for raising an AI PR, but I reviewed it thoroughly. We run a Websocket server on the instance and we want to use the proxy to connect to it from several domains.

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

X Tutup