(env_value: string | undefined): RegExp[] Parses ALLOWED_ORIGINS env var into regex matchers for request source verification.
Origin allowlisting for locally-running services — not the CSRF layer
(that's SameSite: strict on session cookies).
Accepts comma-separated patterns with limited wildcards:
- Exact origins: https://api.fuz.dev
- Wildcard subdomains: https://*.fuz.dev (matches exactly one subdomain level)
- Multiple wildcards: https://*.staging.*.fuz.dev (for deep subdomains)
- Wildcard ports: http://localhost:* (matches any port or no port)
- IPv6 addresses: http://[::1]:3000, https://[2001:db8::1]
- Combined: https://*.fuz.dev:*
Examples:
- http://localhost:3000,https://prod.fuz.dev
- https://*.api.fuz.dev,http://127.0.0.1:*
- http://[::1]:*,https://*.*.corp.fuz.dev:*
env_value
string | undefinedreturns
RegExp[] throws
if- any individual pattern is invalid (missing protocol, partial wildcards, etc.)