これまでCORSの状況では、さらに先に進んでいます。
サーバ#1(http://localhost:33233)は私のサービス(SOAP、WebAPI)がホストされている私の主要なウェブサイトです。私は、CORS要求をサポートするために、Global.asaxの中で、これらの行を追加しました:
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin" , "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
// These headers are handling the "pre-flight" OPTIONS call sent by the browser.
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Accepts, Content-Type, Origin");
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
HttpContext.Current.Response.End();
}
}
また、そのサーバー上で、私は要求を受信したときに、私はヘッダーでセッショントークンを設定しています:
HttpContext.Current.Response.Headers.Set("X-SessionToken", "{...}");
を
サーバー#2(http://localhost:41350/login)は、AngularJSで構築され、リモートサービスと呼ばれる私のモバイルサイトです。
ログイン処理中に、私はSingInサービス(SOAP)を呼び出します。私は、サーバー側のブレークポイントをヒット、私はヘッダーを設定し、応答を返します。往復は機能しています。
しかし、応答側のクライアント側からヘッダーをチェックすると、null値が返されます。
$http({
method: 'POST',
url: 'http://localhost:33233/ws/Authentication.asmx/SignIn',
data: {...}
}).success(function(data, status, header, config) {
var mySession = header('X-TokenSession');
}).error(function(data, status, header, config){
...
});
私はFiddlerまたはChrome DevToolsでチェックしていますが、ネットワークトラフィックのヘッダー値がわかります。
$ httpProviderに問題がありますか?