Skip to content

Conversation

Copy link

Copilot AI commented Nov 14, 2025

Vite 6.0.9+ blocks Cloudflare Quick Tunnel requests by default. When users run slidev --remote --tunnel, the tunnel URL is rejected with "Blocked request. This host is not allowed."

Changes

Modified packages/slidev/node/cli.ts to automatically add .trycloudflare.com to Vite's server.allowedHosts when both --tunnel and --remote flags are present:

server: {
  port,
  strictPort: true,
  open,
  host,
  force,
  // Allow Cloudflare Quick Tunnel domains when tunneling is enabled
  ...(tunnel && remote != null ? { allowedHosts: ['.trycloudflare.com'] } : {}),
}

The configuration only applies when tunneling is active (matching the condition at lines 203-206) and merges with any user-provided allowedHosts in their vite.config.ts.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: node index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>server.allowedHosts</issue_title>
<issue_description>docker部署之后不能用域名进行访问
Blocked request. This host ("xxx.dkln.cn") is not allowed.
To allow this host, add "xxx.dkln.cn" to server.allowedHosts in vite.config.js.</issue_description>

<agent_instructions>When tunneling via cloudflare (e.g. --tunnel), add .trycloudflare.com to Vite's allowedHosts configuration automatically.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@kermanx > This issue is not only valid for `slidev-theme-neversink` but also affects other themes like `@slidev/theme-seriph`. The breaking change was introduced in [Vite 6.0.9](https://github.com/vitejs/vite/blob/v6.0.9/packages/vite/CHANGELOG.md?rgh-link-date=2025-06-15T17%3A26%3A57.000Z). As a temporary workaround, you can downgrade Slidev to version 51.0.2 and Vite to 6.0.8.

In fact, you can just create a vite.config.ts besides your slides.md, and add the erver.allowedHosts configuration. The vite configs are expected to be merged.</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@netlify
Copy link

netlify bot commented Nov 14, 2025

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit ff7b67b
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6916f31908dd2d00089bb7cb
😎 Deploy Preview https://deploy-preview-2346--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kermanx kermanx marked this pull request as ready for review November 14, 2025 09:18
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 14, 2025

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2346

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2346

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2346

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2346

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2346

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2346

commit: ff7b67b

Copilot AI changed the title [WIP] Fix server.allowedHosts configuration for domain access Add .trycloudflare.com to allowedHosts when using --tunnel flag Nov 14, 2025
Copilot AI requested a review from kermanx November 14, 2025 09:21
Copilot finished work on behalf of kermanx November 14, 2025 09:21
@kermanx kermanx changed the title Add .trycloudflare.com to allowedHosts when using --tunnel flag fix: add .trycloudflare.com to allowedHosts when tunnel enabled Nov 14, 2025
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.

server.allowedHosts

2 participants