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

在linner页面里访问其他server的json跨域问题 #22

Closed
i5ting opened this issue Sep 10, 2013 · 3 comments
Closed

在linner页面里访问其他server的json跨域问题 #22

i5ting opened this issue Sep 10, 2013 · 3 comments

Comments

@i5ting
Copy link

i5ting commented Sep 10, 2013

在linner页面里访问其他server的json跨域问题

@SaitoWu
Copy link
Owner

SaitoWu commented Sep 10, 2013

这个有两个解决办法:

  • 在 development 模式下面允许跨域 json 操作.

http://developer.github.com/v3/#cross-origin-resource-sharing

可以参考上面 Github 的 CORS 的配置.

  • 把 Linner 打包好的 public 目录放在 Nginx 下面或者 Sinatra 的 public 目录里面.

然后用 Sinatra 的服务器来启动, 就不会有跨域的问题. ( 我们现在在用这种模式, 不过我们后端是 Java, Rails 类似.

如果是真的跨域问题, 就是要垮服务器取数据.

那就用普通的跨域方案来解决, 跟平时的跨域没有什么区别.

@i5ting
Copy link
Author

i5ting commented Sep 11, 2013

但是我们不希望在linner下开发,然后部署又放到别的服务器上,尤其在开发阶段,很不想这样

有个不太好的办法:

open -a Google\ Chrome --args --disable-web-security

@SaitoWu
Copy link
Owner

SaitoWu commented Sep 11, 2013

@i5ting 这个办法挺好, 第一次见. 👍

不过这种完全脱离的确实是会遇到这种跨域的问题.

@SaitoWu SaitoWu closed this as completed Nov 27, 2013
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