Skip to content

fix(cli): allow any localhost port in CORS config to handle non-3000 dev server#93

Merged
danielroe merged 1 commit intomainfrom
fix/dont-harcode-dev-server-port
Jan 26, 2026
Merged

fix(cli): allow any localhost port in CORS config to handle non-3000 dev server#93
danielroe merged 1 commit intomainfrom
fix/dont-harcode-dev-server-port

Conversation

@serhalp
Copy link
Copy Markdown
Member

@serhalp serhalp commented Jan 26, 2026

When port 3000 is unavailable, Nuxt/Vite automatically picks an alternative port:

[get-port] Unable to find an available port (tried 3000 on host "localhost"). Using alternative port 3001.

But the connector CORS config was hardcoded to only allow the prod host and http://localhost:3000, causing local authentication to fail in an opaque manner.

Screenshot 2026-01-25 at 20 30 43

It now uses a regex pattern to allow any localhost port. This seems fine from a security perspective, and there aren't alternatives with great DX that I can think of.

When port 3000 is unavailable, Nuxt/Vite automatically picks an alternative port:

```
[get-port] Unable to find an available port (tried 3000 on host "localhost"). Using alternative port 3001.
```

But the connector CORS config was hardcoded to only allow the prod host and `http://localhost:3000`,
causing local authentication to fail in an opaque manner.

It now uses a regex pattern to allow any localhost port. This seems fine from a security
perspective, and there aren't alternatives with great DX that I can think of.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 26, 2026

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

Project Deployment Review Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jan 26, 2026 1:31am

Request Review

@serhalp serhalp requested a review from danielroe January 26, 2026 01:39
@danielroe danielroe merged commit c1e4c12 into main Jan 26, 2026
8 checks passed
@danielroe danielroe deleted the fix/dont-harcode-dev-server-port branch January 26, 2026 08:27
vinnymac pushed a commit to vinnymac/npmx.dev that referenced this pull request Jan 28, 2026
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.

2 participants