Skip to content

Commit bddd64d

Browse files
authored
fix: optimize the judgment on whether HTTPS has been set in options (#7202)
1 parent ef08a08 commit bddd64d

File tree

1 file changed

+5
-1
lines changed
  • packages/@vue/cli-service/lib/commands

1 file changed

+5
-1
lines changed

packages/@vue/cli-service/lib/commands/serve.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ module.exports = (api, options) => {
101101
}
102102

103103
// resolve server options
104-
const useHttps = args.https || projectDevServerOptions.https || defaults.https
104+
const modesUseHttps = ['https', 'http2']
105+
const serversUseHttps = ['https', 'spdy']
106+
const optionsUseHttps = modesUseHttps.some(modeName => !!projectDevServerOptions[modeName]) ||
107+
(typeof projectDevServerOptions.server === 'string' && serversUseHttps.includes(projectDevServerOptions.server))
108+
const useHttps = args.https || optionsUseHttps || defaults.https
105109
const protocol = useHttps ? 'https' : 'http'
106110
const host = args.host || process.env.HOST || projectDevServerOptions.host || defaults.host
107111
portfinder.basePort = args.port || process.env.PORT || projectDevServerOptions.port || defaults.port

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy