Skip to content

Commit 622ebc7

Browse files
authored
fix(cli-service): pass --public host to devserver (#6066)
Fixes #3220 Prevent "Invalid Host" error by passing public host to dev server when --public is used
1 parent 1aef726 commit 622ebc7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: lib/commands/serve.js

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ module.exports = (api, options) => {
112112
? rawPublicUrl
113113
: `${protocol}://${rawPublicUrl}`
114114
: null
115+
const publicHost = publicUrl ? /^[a-zA-Z]+:\/\/([^/?#]+)/.exec(publicUrl)[1] : undefined
115116

116117
const urls = prepareURLs(
117118
protocol,
@@ -188,6 +189,7 @@ module.exports = (api, options) => {
188189
}, projectDevServerOptions, {
189190
https: useHttps,
190191
proxy: proxySettings,
192+
public: publicHost,
191193
// eslint-disable-next-line no-shadow
192194
before (app, server) {
193195
// launch editor support.

0 commit comments

Comments
 (0)