Skip to content

Invalid URL when using https and --open in v6.1.0 #19408

@keatkeat87

Description

@keatkeat87

Describe the bug

After upgrading from v6.0.10 to v6.1.0, my code stopped working.

I found some differences
vite.config.ts

import { defineConfig } from 'vite'

export default defineConfig({
  server: {
    host: '192.168.0.152',
    port: 4200,
    https: {
      cert: '192.168.0.152.crt',
      key: '192.168.0.152.key',
    },
  },
});

v6.0.10 yarn dev
Image

v6.1.0 yarn dev
Image

In v6.1.0, there are two URLs. If I use yarn dev and visit https://192.168.0.152:4200/, it works fine. But if I run the command yarn dev --open, it shows an error.

Image

Note: but if I run vite --open, it works.

Reproduction

https://github.com/keatkeat87/vite-issue-https-open

Steps to reproduce

git clone https://github.com/keatkeat87/vite-issue-https-open

yarn install

yarn dev --open

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
    Memory: 17.28 GB / 31.76 GB
  Binaries:
    Node: 22.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.70)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    vite: ^6.1.0 => 6.1.0

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-edge-caseBug, but has workaround or limited in scope (priority)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions