Skip to content
This repository has been archived by the owner on Oct 19, 2019. It is now read-only.

SuperWebSockets issue on Chrome connecting with SSL #40

Open
NaderHamzei opened this issue Jul 15, 2017 · 2 comments
Open

SuperWebSockets issue on Chrome connecting with SSL #40

NaderHamzei opened this issue Jul 15, 2017 · 2 comments

Comments

@NaderHamzei
Copy link

I am having a problem with Chrome and Firefox with immediate disconnect. IE does not have a problem.

Chrome and FireFox drop connection right after they attempt to connect

IE works fine but it is the browser that Dev Environment is using.

My project uses SuperWebSockets in a Windows C# .NET 4.5.2 platform. It includes MS Owin Security Membership for authentication. Chrome works when unauthenticated.

I am using SSL in VS 2015 Dev environment based on the info from Hanselman’s page:
https://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

The localhost.pfx is in both in Personal and Trusted Root.

IE has no problems,

Chrome is working with SSL when it comes to navigating the site pages but not chat. On pages, it does display ‘Not Secure’ in upper left before location address and the ‘https’ has a line through it. When I navigate to chat with Chrome, I get the Status Code 1006

Firefox wouldn’t load the site because I am using a self signed cert until I created an exception.
However, when I tried the websocket chat, there error Firefox produced is:

“Firefox can’t establish a connection to the server at wss://localhost:8080/”, again with Status Code 1006.

When I added this address as security exception, The results of Firefox matched Chrome.

I have my server running as a console application. I am using config to load the SuperWebSocket AppServer. This is my server info:

`var config = new RootConfig();
var serverConfig = new ServerConfig
{
Name = "SecureSuperWebSocket",
Ip = "Any",
Port = 8080,
Mode = SocketMode.Tcp,
Security = "tls",
Certificate = new SuperSocket.SocketBase.Config.CertificateConfig
{
FilePath = @"C:\cert\localhost.pfx",
Password = "password",
}
};

var config = new RootConfig();
var serverConfig = new ServerConfig
{
Name = "SecureSuperWebSocket",
Ip = "Any",
Port = 8080,
Mode = SocketMode.Tcp,
Security = "tls",
Certificate = new SuperSocket.SocketBase.Config.CertificateConfig
{
FilePath = @"C:\cert\localhost.pfx",
Password = "password",
}
};
`

Listed Below you will find header Request & Response:

Request Header:
GET wss://localhost:8080/ HTTP/1.1
Host: localhost:8080
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: https://localhost
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.8
Cookie: ASP.NET_SessionId=emcrnvstlf1qzminwio3fdjh; __RequestVerificationToken=9W-RF42eLvqBKlmWhVjiwO-fKaOjd95wN9zbqkqsREZjp4NYYqNKxVsOaEbZoH5--x4LbFox-KR8XrKeax4kZipObDetBTK41icSAyHxbyc1; .AspNet.ApplicationCookie=NWIjgt4GDVC9zZE5g4BD1EItF28631kgz0-3yHucVKJzcw1rH5wLaNVJj02U0pewtkZ3pQ-DYzai54daLZxEzNWhg_HfAiNI-4SYqX7V0Tzafedt5gDwjt7hLWbYvMaS6uQFYqfM-lSJ_q6j27v8K-mg6MEdZkiGDehnOjIE5TCB8y1LA12zoTSESluMRFsA2JzMJr8ylNr0XKwSYmOh2DlRa5h7_MAB5PBMdgCeLBbvS9sQtFrUgTFdckm5efg9m_iy11_bbegq4BVllyD3_vUfqhUpleRhm1vOaCnIiM0U-CnEDZVqE1tYAyQRwhB03tlBfitJTW7k8KOAJcfiBlg_kXsxz49dmRH1Jf0qgb99RB0hJ_x5i4YF8w3SIZUNXF4rc5AfOcKSpu1LLacs0Tx47-CEQeBxK4YyAYASuWbnGKxFiwBFPdW5yXALc_Hakrg5f2PgDtisko8d7oavGF_ZTrrSFDGMYSRpRtn464pG7n38YfRliAhqRgb8zgNF
Sec-WebSocket-Key: XtMCuOCoCpxYJwRBZyuW0g==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

Response Header:
HTTP/1.1 101 Switching Protocols
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Accept: w154TBvSuhc7EQv0LO243p3v2JI=

Debugging SuperWebSocket as far as I can, here are the following areas that returns error:

File: WebSocketProtocol.cs
public IReceiveFilter CreateFilter(IAppServer appServer, IAppSession appSession, System.Net.IPEndPoint remoteEndPoint)
{
return new WebSocketHeaderReceiveFilter((IWebSocketSession)appSession);
}

File: WebSocketReceiveHeaderFilter.cs
public WebSocketHeaderReceiveFilter(IWebSocketSession session)
: base(session)
{
m_SearchState = new SearchMarkState(m_HeaderTerminator);
}

Any ideas what I need to do to get Firefox and Chrome working in test environment?

@softreigns
Copy link

i had had a similar issue where the certis missing the alt subject name attribute, which was required as per the recent chrome update. Make sure your cert contain that attribute and that you have the cert CA in your window root CAs.

@darkmansad
Copy link

Has similar issue trying to connect from Chrome. The certificates were installed but no connection could be made, received just the closing event. I succeded to make it work by making a paste of folloging link "chrome://flags/#allow-insecure-localhost" into chrome tab, and from there i succede to enable the option "Allow invalid certificates for resources loaded from localhost."

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants