claude-code - 💡(How to fix) Fix [FEATURE] Preview should allow localhost subdomains (e.g. playground.localhost) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47195Fetched 2026-04-13 05:38:56
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Fix Action

Fix / Workaround

Currently there's no workaround within Preview. The only option is to open the URL manually in a separate browser, which defeats the purpose of the integrated preview.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When using the Preview feature, navigating to a localhost subdomain like playground.localhost:3000 is blocked with the message:

Link to playground.localhost was blocked. Preview only supports localhost URLs.

Localhost subdomains resolve to 127.0.0.1 the same as localhost and are commonly used in local development (e.g. multi-tenant apps that route by subdomain). The preview URL allowlist should permit *.localhost in addition to localhost.

<img width="549" height="93" alt="Image" src="https://github.com/user-attachments/assets/45cf473d-62e4-4c11-9206-846a943bb106" />

Proposed Solution

The Preview URL allowlist should permit *.localhost in addition to localhost. All subdomains of localhost (e.g. playground.localhost, app.localhost) resolve to 127.0.0.1 per RFC 6761 and are safe to allow. No configuration should be needed — this should just work out of the box.

Alternative Solutions

Currently there's no workaround within Preview. The only option is to open the URL manually in a separate browser, which defeats the purpose of the integrated preview.

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

  1. I'm building a multi-tenant SaaS app (Tightknit) where each community is accessed via a localhost subdomain in local dev (e.g. playground.localhost:3000)
  2. I set up .claude/launch.json and start the dev server via Preview
  3. The app loads at localhost:3000 then redirects to playground.localhost:3000
  4. Preview blocks the redirect with "Link to playground.localhost was blocked"
  5. I have to copy the URL and open it in a separate browser, losing the integrated preview workflow

Additional Context

Localhost subdomains are guaranteed to resolve to loopback by RFC 6761 and are widely used by frameworks like Next.js, Vite, and Rails for multi-tenant local development. Most browsers and dev tools treat them identically to localhost.

extent analysis

TL;DR

Update the Preview URL allowlist to include *.localhost in addition to localhost to support localhost subdomains.

Guidance

  • Review the current Preview URL allowlist configuration to understand how to modify it.
  • Consider adding a wildcard (*) to the allowlist to permit all subdomains of localhost (e.g., *.localhost).
  • Verify that the updated allowlist resolves the issue by testing with a localhost subdomain (e.g., playground.localhost:3000).
  • If the issue persists, investigate any additional configuration or flags required for the Preview feature to support subdomains.

Example

No code snippet is provided as the issue does not imply a specific code change, but rather a configuration update.

Notes

The proposed solution relies on the assumption that the Preview feature's allowlist can be modified to include wildcard subdomains. If this is not possible, an alternative solution may be required.

Recommendation

Apply the workaround by updating the Preview URL allowlist to include *.localhost, as this is a widely used and safe practice according to RFC 6761.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [FEATURE] Preview should allow localhost subdomains (e.g. playground.localhost) [1 participants]