【问题标题】:Connecting to an HTTPS service with SproutCore使用 SproutCore 连接到 HTTPS 服务
【发布时间】:2011-11-16 16:50:26
【问题描述】:

我正在构建一个需要我连接到服务 (https) 以获取一些数据的网络应用程序。 Web 应用程序将使用 SproutCore 构建。现在,我对 SproutCore 非常陌生,并且无法连接到该服务。 irc 频道上的一些人非常乐于助人,并告诉我要连接到 https 服务,我需要在我的 BUILDFILE 中添加一行:

proxy '/path', :to => "https://myWebService.com", :secure => true

我做到了。但是,如果我尝试使用以下方式导航到 url:

SC.Request.getUrl('/path').notify(this, 'notifyMe').send();

我得到一个 404: 获取http://localhost:4020/path 404(未找到)。

关于如何连接到我的 HTTPS 服务的任何想法。此外,我想声明,一旦我连接,我需要使用基本身份验证(用户名和密码)对其进行身份验证。

谢谢大家!

编辑:只是想提一下这个请求是跨域的。我的印象是 GET 跨域工作得很好。

【问题讨论】:

    标签: javascript https sproutcore


    【解决方案1】:

    变化:

    proxy '/path', :to => "https://myWebService.com", :secure => true
    

    proxy '/', :to => "myWebService.com", :secure => true
    

    然后

    SC.Request.getUrl('/path').notify(this, 'notifyMe').send();
    

    应该有效

    【讨论】:

    • 不。 myWebservice 是网址,实际上并不是我编写的 Web 服务。这是过去几年一直存在的网络服务,我希望从中获取数据。我所有的本机应用程序都在使用该服务。这是我第一次制作 web 应用程序,它也需要该服务。我试过这样做:proxy '/path', :to => "myWebService.com", :secure => trueproxy '/path', :to => "https://myWebService.com", :secure => trueproxy '/path', :to => "myWebService.com", :protocol => 'https', :secure => true他们都没有工作。 :(
    • 好的,在运行 sc-server 的命令提示符中显示的 url 是什么?你应该能够看到类似PROXY https://myWebservice.com/path 404
    • 嗯。我看不到。我看到的 404 在浏览器控制台上。术语窗口向我显示:SproutCore v1.6.0.1 Development Server Starting server at http://0.0.0.0:4020 in debug mode To quit sc-server, press Control-C >> Thin web server (v1.2.11 codename Bat-Shit Crazy) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:4020, CTRL+C to stop
    • 好的,我们正在接近这个问题。构建文件中的代理信息是否在运行 sc-server 的目录中?
    • 很高兴为您提供帮助。你可以以我的名字命名你的第一个孩子;)
    猜你喜欢
    • 2014-04-06
    • 2016-07-05
    • 1970-01-01
    • 1970-01-01
    • 2013-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-16
    相关资源
    最近更新 更多