lisong / code-push-web

code-push-server web客户端
MIT License
66 stars 41 forks source link

跨域无法正常运转 #5

Open zzyyzz1992 opened 7 years ago

zzyyzz1992 commented 7 years ago

点击注册按钮输入邮箱无反应,12302端口为code-push-server端口,12303为code-push-web端口 //真实ip隐藏掉了 Console显示: Fetch API cannot load http://我的ip:12302/users/exists?email=18035177869@163.com. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://我的ip:12303' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

网上查询到关闭网络安全的命令(Windows): chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security 关闭后可以正常访问。 还请大神解答,谢谢!

lisong commented 7 years ago

参考 https://github.com/lisong/code-push-web/issues/1 设置跨域

zzyyzz1992 commented 7 years ago

感谢,在生产模式下亦进行此设置,登陆、邮箱模块都正常运转。 app.all('*', function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization"); res.header("Access-Control-Allow-Methods","PUT,POST,GET,PATCH,DELETE,OPTIONS"); next(); });

还有一个问题请教: 就是使用 code-push-cli 查看应用版本是正常的: `Zeyangs-MacBook-Pro:Mobile zzy$ code-push deployment ls Mobile-android ┌────────────┬──────────────────────────────────┬──────────────────────┐

│ Name │ Update Metadata │ Install Metrics │ ├────────────┼──────────────────────────────────┼──────────────────────┤ │ Production │ Label: v2 │ Active: 50% (1 of 2) │ │ │ App Version: 1.3.0 │ Total: 1 (1 pending) │ │ │ Mandatory: No │ │ │ │ Release Time: 30 minutes ago │ │ │ │ Released By: 18035177869@163.com │ │ ├────────────┼──────────────────────────────────┼──────────────────────┤ │ Staging │ Label: v4 │ Active: 0% (0 of 0) │ │ │ App Version: 1.3.0 │ Total: 0 │ │ │ Mandatory: No │ │ │ │ Release Time: 32 minutes ago │ │ │ │ Released By: 18035177869@163.com │ │ └────────────┴──────────────────────────────────┴──────────────────────┘ Zeyangs-MacBook-Pro:Mobile zzy$ code-push deployment ls Mobile-ios ┌────────────┬──────────────────────────────────┬─────────────────────┐ │ Name │ Update Metadata │ Install Metrics │ ├────────────┼──────────────────────────────────┼─────────────────────┤ │ Production │ Label: v7 │ Active: 0% (0 of 2) │ │ │ App Version: 1.3.0 │ Total: 0 │ │ │ Mandatory: No │ │ │ │ Release Time: 32 minutes ago │ │ │ │ Released By: 18035177869@163.com │ │ ├────────────┼──────────────────────────────────┼─────────────────────┤ │ Staging │ Label: v8 │ Active: 0% (0 of 4) │ │ │ App Version: 1.3.0 │ Total: 0 │ │ │ Mandatory: No │ │ │ │ Release Time: 32 minutes ago │ │ │ │ Released By: 18035177869@163.com │ │ └────────────┴──────────────────────────────────┴─────────────────────┘ ` 但是在 web 端都是空的:

1 2

请问何故? 望能在百忙之中解答一下,谢谢:)

WaterEye0o commented 6 years ago

+1 我这边code-push用命令行也看到了有输出 但是web上面什么数据都没有

WaterEye0o commented 6 years ago

@zzyyzz1992 请问web没更新的问题解决了吗?

zzyyzz1992 commented 6 years ago

@WaterEye0o web端我这边没有深究了,终端命令够用就好了,太忙了...

WaterEye0o commented 6 years ago

恩好的谢谢 @zzyyzz1992