Skip to content

Commit

Permalink
fix(ui): fix the incorrect RegExp used for CORS check
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Feb 7, 2020
1 parent 70fbd74 commit 0d0168b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@vue/cli/lib/ui.js
Expand Up @@ -6,7 +6,7 @@ function simpleCorsValidation (allowedHost) {
return function (req, socket) {
const { host, origin } = req.headers
// maybe we should just use strict string equal?
const hostRegExp = new RegExp(`^(${host}|${allowedHost}|localhost)(:\\d+)?$`)
const hostRegExp = new RegExp(`^https?://(${host}|${allowedHost}|localhost)(:\\d+)?$`)

if (!origin || !hostRegExp.test(origin)) {
socket.destroy()
Expand Down

0 comments on commit 0d0168b

Please sign in to comment.