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

使用本地host域名访问时,页面502 #405

Open
JoyfulAndSpeedyMan opened this issue Jan 17, 2024 · 0 comments
Open

使用本地host域名访问时,页面502 #405

JoyfulAndSpeedyMan opened this issue Jan 17, 2024 · 0 comments

Comments

@JoyfulAndSpeedyMan
Copy link

复现过程

  1. 使用clone mini分支,然后pnpm install安装依赖
  2. 使用pnpm dev运行,结果如下:
PS D:\workspace\MyProject\vue-element-plus-admin-mini> pnpm dev

> vue-element-plus-admin@2.5.5 dev D:\workspace\MyProject\vue-element-plus-admin-mini
> pnpm vite --mode base

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
                                                                                                                                                                                                           15:15:52
  VITE v5.0.11  ready in 3845 ms

  ➜  Local:   http://localhost:4000/                                                                                                                                                                       15:15:52
  ➜  Network: http://2.0.0.1:4000/                                                                                                                                                                         15:15:52
  ➜  Network: http://10.1.85.6:4000/                                                                                                                                                                       15:15:52
  ➜  Network: http://172.16.192.55:4000/                                                                                                                                                                   15:15:52
  ➜  Network: http://172.24.112.1:4000/                                                                                                                                                                    15:15:52
  ➜  Network: http://172.21.80.1:4000/                                                                                                                                                                     15:15:52
  ➜  press h + enter to show help  
  1. 其中,除http://2.0.0.1:4000/ 之外,都可以正常打开页面
  2. 但是当我修改本地host文件,解析域名a.b.c127.0.0.1时,访问页面将会出现502错误
    image

image
我的尝试

  1. 我猜可能和127.0.0.1有关,然后我使用同样的方式,添加了一个新的host,b.b.c172.16.192.55,但是结果一样的
    image
    image
  2. 我又尝试将vite.config.ts文件的server.host从原来的0.0.0.0修改成a.b.c(修改属性值为true也是结果一样的)
    image
    这时控制台会显示这样
5:24:50 [vite] vite.config.ts changed, restarting server...                                                                                                                                               15:24:50  
15:24:50 [vite] server restarted.                                                                                                                                                                          15:24:50
                                                                                                                                                                                                           15:24:50
  ➜  Network: http://a.b.c:4000/  

这时在点击链接http://a.b.c:4000/ ,还是会出现同样的错误

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

1 participant