code-push-web icon indicating copy to clipboard operation
code-push-web copied to clipboard

跨域无法正常运转

Open zzyyzz1992 opened this issue 8 years ago • 6 comments
trafficstars

点击注册按钮输入邮箱无反应,12302端口为code-push-server端口,12303为code-push-web端口 //真实ip隐藏掉了 Console显示: Fetch API cannot load http://我的ip:12302/users/[email protected]. 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 关闭后可以正常访问。 还请大神解答,谢谢!

zzyyzz1992 avatar Sep 19 '17 20:09 zzyyzz1992

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

lisong avatar Sep 20 '17 01:09 lisong

感谢,在生产模式下亦进行此设置,登陆、邮箱模块都正常运转。 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: [email protected] │ │ ├────────────┼──────────────────────────────────┼──────────────────────┤ │ Staging │ Label: v4 │ Active: 0% (0 of 0) │ │ │ App Version: 1.3.0 │ Total: 0 │ │ │ Mandatory: No │ │ │ │ Release Time: 32 minutes ago │ │ │ │ Released By: [email protected] │ │ └────────────┴──────────────────────────────────┴──────────────────────┘ 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: [email protected] │ │ ├────────────┼──────────────────────────────────┼─────────────────────┤ │ Staging │ Label: v8 │ Active: 0% (0 of 4) │ │ │ App Version: 1.3.0 │ Total: 0 │ │ │ Mandatory: No │ │ │ │ Release Time: 32 minutes ago │ │ │ │ Released By: [email protected] │ │ └────────────┴──────────────────────────────────┴─────────────────────┘ ` 但是在 web 端都是空的: 1 2

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

zzyyzz1992 avatar Sep 22 '17 16:09 zzyyzz1992

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

WaterEye0o avatar Dec 13 '17 06:12 WaterEye0o

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

WaterEye0o avatar Dec 13 '17 06:12 WaterEye0o

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

zzyyzz1992 avatar Dec 17 '17 03:12 zzyyzz1992

恩好的谢谢 @zzyyzz1992

WaterEye0o avatar Dec 18 '17 01:12 WaterEye0o