Skip to content

[vite] Internal server error: Cannot read properties of null (reading 'split') #10389

@xuoutput

Description

@xuoutput

Describe the bug

vite server proxy

    proxy: {
      '^/dev-api/.*': {
        target: DEV_URL,
        changeOrigin: true,
        rewrite: (path) => {
          return path.replace(/^\/dev-api/, '')
        },
      },
    },
const DEV_URL = 'http://auth.test.cloud:8000';   // ok
const DEV_URL = 'https://auth.test.cloud:8000';   // ok
const DEV_URL = '//auth.test.cloud:8000';         // error so why?

so why?

Reproduction

https://stackblitz.com/edit/vitejs-vite-d1x3wu?file=vite.config.js&terminal=dev
Open and then access /foo

Steps to reproduce

No response

System Info

vite 3.1.6

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions