Skip to content

Conversation

wo-o29
Copy link
Contributor

@wo-o29 wo-o29 commented Aug 27, 2025

Description

This PR fixes the type definition of preview.allowedHosts in the Vite documentation.
The type was incorrectly specified as string | true, but it should be string[] | true to align with the actual implementation and server.allowedHosts type.

interface CommonServerOptions {
  /**
   * The hostnames that Vite is allowed to respond to.
   * `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
   * When using HTTPS, this check is skipped.
   *
   * If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
   * For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
   *
   * If set to `true`, the server is allowed to respond to requests for any hosts.
   * This is not recommended as it will be vulnerable to DNS rebinding attacks.
   */
  allowedHosts?: string[] | true;
}
스크린샷 2025-08-27 오전 10 38 35

What was changed

  • Corrected the type of preview.allowedHosts from string | true to string[] | true.
  • Kept the rest of the description and default value as is, linking to server.allowedHosts for details.

Why this change is necessary

  • Provides accurate and consistent documentation.
  • Helps users understand the correct expected configuration type for preview.allowedHosts.

@sapphi-red sapphi-red changed the title docs(preview): fix type of preview.allowedHosts to 'string[] | true' docs(config): fix type of preview.allowedHosts to 'string[] | true' Aug 27, 2025
@sapphi-red sapphi-red added the documentation Improvements or additions to documentation label Aug 27, 2025
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sapphi-red sapphi-red merged commit 91b5dc1 into vitejs:main Aug 27, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants