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

connot open app use local ip #914

Closed
wangxiangyao opened this issue Mar 1, 2018 · 3 comments
Closed

connot open app use local ip #914

wangxiangyao opened this issue Mar 1, 2018 · 3 comments

Comments

@wangxiangyao
Copy link

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.

@yyx990803
Copy link
Member

yyx990803 commented Mar 1, 2018

Should be fixed by #868

@wangxiangyao
Copy link
Author

wangxiangyao commented Mar 2, 2018

如果想要做反向代理,还需要在vue.config.js中配置

// vue.config.js
module.exports = {
  devServer: {
    disableHostCheck: true,
  }
}

@wangxiangyao
Copy link
Author

很感谢,没有代理很多功能开发很麻烦

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