问题
I'm building a web app that requires me to connect to a service (https) to get some data. The web app is to be built using SproutCore. Now, I'm super new to SproutCore, and haven't been able to get to connect to the service. Some folks on the irc channel were super helpful and told me that to connect to an https service, I need to add a line in my BUILDFILE that says:
proxy '/path', :to => "https://myWebService.com", :secure => true
I did that. However, if I try to navigate to the url using:
SC.Request.getUrl('/path').notify(this, 'notifyMe').send();
I get a 404: GET http://localhost:4020/path 404 (Not Found).
Any idea as to how I can connect to my HTTPS service. Additionally, I would like to state that once I connect, I would need to authenticate with it using basic auth (username and password).
Thanks all!
EDIT: Just wanted to mention that this request is Cross-Domain. I was under the impression that GET worked just fine cross domain.
回答1:
Change:
proxy '/path', :to => "https://myWebService.com", :secure => true
to
proxy '/', :to => "myWebService.com", :secure => true
then
SC.Request.getUrl('/path').notify(this, 'notifyMe').send();
should work
来源:https://stackoverflow.com/questions/8155461/connecting-to-an-https-service-with-sproutcore