socket.io-client icon indicating copy to clipboard operation
socket.io-client copied to clipboard

Bug in xdomain detection

Open mrbrdo opened this issue 16 years ago • 2 comments

the Socket.prototype._isXDomain function has a problem when the website is on the same domain, but different subdomain (which is still allowed for XHR). It will return that it is a cross-domain request but actually it should return false. I mean when you set document.domain manually so that you can communicate with iframe on different subdomain... Please fix. One dirty fix could be: return this.host.indexOf(document.domain) < 0; More proper would be to check if host ends with document.domain.

Example configuration for this problem: this.host = "abc.domain.com" document.domain = "domain.com"

mrbrdo avatar Oct 02 '10 23:10 mrbrdo

Different subdomain is still cross domain

rauchg avatar Mar 06 '11 07:03 rauchg

No it is not !,

Let's say that you have

you host = "domain.com" server = "ssever.domain.com"

If i understand correctly isXDomain should be only true if you cann't connect to "server" from your web page on "you host".

Please explain me why not if i'm wrong ?

Thanks !

dymsza avatar Jun 07 '12 20:06 dymsza