Skip to content

Commit 0d0168b

Browse files
committed
fix(ui): fix the incorrect RegExp used for CORS check
1 parent 70fbd74 commit 0d0168b

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

packages/@vue/cli/lib/ui.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function simpleCorsValidation (allowedHost) {
66
return function (req, socket) {
77
const { host, origin } = req.headers
88
// maybe we should just use strict string equal?
9-
const hostRegExp = new RegExp(`^(${host}|${allowedHost}|localhost)(:\\d+)?$`)
9+
const hostRegExp = new RegExp(`^https?://(${host}|${allowedHost}|localhost)(:\\d+)?$`)
1010

1111
if (!origin || !hostRegExp.test(origin)) {
1212
socket.destroy()

0 commit comments

Comments
 (0)