diff --git a/package.json b/package.json index 3d6e4eb..79d1607 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unplugin-https-reverse-proxy", "type": "module", - "version": "2.0.0", + "version": "2.0.1", "description": "", "license": "MIT", "homepage": "https://github.com/zcf0508/unplugin-https-reverse-proxy#readme", diff --git a/src/index.ts b/src/index.ts index aeec73a..8afb542 100644 --- a/src/index.ts +++ b/src/index.ts @@ -102,6 +102,11 @@ export const unpluginFactory: UnpluginFactory = options => ({ return } + if (target.match(/^(?:https?)?:\/\//)) { + consola.fail('target must be a domain') + return + } + const _printUrls = server.printUrls.bind(server) let source = `localhost:${config.server.port || 5173}` @@ -138,6 +143,11 @@ export const unpluginFactory: UnpluginFactory = options => ({ return } + if (target.match(/^(?:https?)?:\/\//)) { + consola.fail('target must be a domain') + return + } + const devServer = { host: 'localhost', port: 8080, @@ -200,6 +210,11 @@ export const unpluginFactory: UnpluginFactory = options => ({ return } + if (target.match(/^(?:https?)?:\/\//)) { + consola.fail('target must be a domain') + return + } + const devServer = { host: 'localhost', port: 8080, diff --git a/src/nuxt.ts b/src/nuxt.ts index 6affe39..9685d94 100644 --- a/src/nuxt.ts +++ b/src/nuxt.ts @@ -36,6 +36,11 @@ export default defineNuxtModule({ return } + if (target.match(/^(?:https?)?:\/\//)) { + consola.fail('target must be a domain') + return + } + // https://github.com/nuxt/cli/issues/220#issuecomment-1735394141 _nuxt.hook('listen', (_, listener) => { const url = listener.url