Skip to content

connot open app use local ip #914

Closed
Closed
@wangxiangyao

Description

@wangxiangyao

Version

2.9.3

Reproduction link

https://github.com/wangxiangyao/venusManage

Steps to reproduce

最近我升级了vue-cli,这个项目是升级后写的。
任何一个新vue-cli创建的项目,应该都有这个问题

npm run dev运行项目后,在浏览器用localhost:8080打开,没有问题。但是用本机ip打开就不行,比如'192.168.1.9:8080'

我把很早以前,用老版本vue-cli创建的项目运行了下,是可以打开的

网上有人说,修改devServer配置的host为0.0.0.0,。这样是可以通过ip打开了。但是项目中需要使用外网nginx代理到本地,进行开发(微信支付之类的功能),这个反向代理依然不能使用。

What is expected?

期望可以使用ip直接打开项目,并且可以使用反向代理

What is actually happening?

不能用ip打开,反向代理失败


init a new appvue init webpack proj
then
cd proj
npm run dev
open chrome and input url 'localhost:8080' At this point, I can access my website.
but if i input url '192.168.1.9:8080',There was a mistake. I couldn't open the site properly.

Some people say that you can solve the problem by changing the host ( localhost -> 0.0.0.0)
That's possible, but when i use Nginx reverse proxy. it dosen't work.

I demoted vue-cli to 1.1.2. and creat a new project .There was no problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions