Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on dev server start #3

Open
LAXITKUMAR opened this issue Feb 26, 2023 · 1 comment
Open

Error on dev server start #3

LAXITKUMAR opened this issue Feb 26, 2023 · 1 comment

Comments

@LAXITKUMAR
Copy link

LAXITKUMAR commented Feb 26, 2023

Getting following error on start:

error when starting dev server:
TypeError: Cannot read property '0' of undefined
    at t.use.viteProtocol (/Users/klaxit/Documents/GitHub/git-wt-ui-vite-master/node_modules/vite-plugin-proxy-middleware/dist/index.js:1:3123)
    at configureServer (/Users/klaxit/Documents/GitHub/git-wt-ui-vite-master/node_modules/vite-plugin-proxy-middleware/dist/index.js:1:3481)
    at createServer (file:///Users/klaxit/Documents/GitHub/git-wt-ui-vite-master/node_modules/vite/dist/node/chunks/dep-3007b26d.js:61302:30)
    at async CAC.<anonymous> (file:///Users/klaxit/Documents/GitHub/git-wt-ui-vite-master/node_modules/vite/dist/node/cli.js:734:24)

OS: MacOS Ventura 13.0.1
Node version: 14.18.3
"vite-plugin-proxy-middleware": "^1.0.2"
"vite": "^4.1.1",

Proxy-table: content

module.exports = {
  "/api": {
    https: true,
    target: "https://<SomeIp>",
    rewrite: path => path,
    secure: false,
    changeOrigin: true,
  },
};

config added in plugin section

VitePluginProxyMiddleware({
      proxyTable: resolve(__dirname, "./proxy-table"),
    }),

Vite server configuration

  server: {
    port: 8000,
    https: {
      key: "./.cert/key.pem",
      cert: "./.cert/cert.pem",
    },
  },
@leobaixinxin
Copy link

you can change it like this, try it

VitePluginProxyMiddleware({
  proxyTable: {
    "/api": {
      https: true,
      target: "https://",
      rewrite: path => path,
      secure: false,
      changeOrigin: true,
    },
  },
}),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants