Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR cross domain not working on browsers other than IE10

I am writing a web app using SignalR cross domain communication. I am using the latest version of SignalR, 1.0.1. Following is the code in the jQuery's document ready event:

var connection = $.hubConnection(url);
  var proxy = connection.createHubProxy(hubName);

  connection.start().done(function () {
    proxy.invoke('serverMethod');
  });

I tried running the application on Opera, Firefox, Chrome and IE 10. My OS is Windows 7. It works well on IE 10 and doesn't work on other browsers. I changed mode of IE using developer tools to IE 9, and it stopped working. The same code works on all browsers if I use SignalR version 0.5.3.

In developer tools of the browser, I found the following HTTP status code in response of negotiation request: "HTTP/1.1 403 Forbidden".

Am I missing anything here? What is the reason because of which it is breaking on browsers other than IE 10?

like image 906
S. Ravi Kiran Avatar asked Mar 09 '13 14:03

S. Ravi Kiran


1 Answers

Ensure that in your MapHubs call that you enable cross domain.

RouteTable.Routes.MapHubs(new HubConfiguration() { EnableCrossDomain = true });

When testing cross domain locally IE10 has an interesting feature that treats any localhost port as not being cross domain.

like image 64
N. Taylor Mullen Avatar answered Sep 28 '22 02:09

N. Taylor Mullen