I’m working with apache and tomcat server in ubuntu server with a web app made of web pages and websockets.
Web pages are served from Apache HTTPD and tomcat serves websockets. Both use the same L.E. SSL certificate.
Apache well works with HTTPS but I found a problem with websockets.
If I use Chrome the websocket secure connection fails with this log: WebSocket connection to 'wss://my.website.com:8443/pv' failed: WebSocket opening handshake was canceled
this log is produced in this code line: new WebSocket(myWsUrl);
I have no further logs,
If I use Chrome switching to http and non-secure webservice connection (ws://), it works!
If I use Firefox, it works perfectly with both secure (wss://) and not secure (wss://)!
Can you tell me why Chrome complains about this secure connection?
If the site is “offline” or you are just overly paranoid (but then you probably shouldn’t have your server on the Internet), you could try showing the output of:
openssl s_client -connect my.website.com:8443 -servername my.website.com
My domain is demo.cinebot.it the websockets starts after login so you can only see the certificate provided by Tomcat from this url: https://demo.cinebot.it:8443/ as HTTPS not as WSS, but the certificate is the same.
Seems like you don’t offer the certificate chain, just the leaf certificate. Try to point your Apache to fullchain.pem or include the Lets Encrypt intermediate in your certificate.
I confirm that tomcat was using only cert.pem and not the full chain. I changed my server.xml configuration adding SSLCertificateChainFile with chain.pem file.
Now this is the output of openssl command:
CONNECTED(00000003)
---
Certificate chain
0 s:/CN=demo.cinebot.it
i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
1 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
i:/O=Digital Signature Trust Co./CN=DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFDzCCA/egAwIBAgISA1MvRi8iL6l4Eo2Pw+P1Jw/qMA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xNzA5MjAwMzMwMDBaFw0x
NzEyMTkwMzMwMDBaMBoxGDAWBgNVBAMTD2RlbW8uY2luZWJvdC5pdDCCASIwDQYJ
KoZIhvcNAQEBBQADggEPADCCAQoCggEB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5cHQu
b3JnL3JlcG9zaXRvcnkvMA0GCSqGSIb3DQEBCwUAA4IBAQAPgOy3qJ9sgQ2tqMnH
O/8XPMEMSq6HK7ABHajunQar4Fe5AAImx7J+D1zwvo8r4jXb5fSmBwWfij2qUlEH
pDV4hUMOP4JRwvhmHrBnf7wi8RvFE1GhXU3H+2/PIa9qsHc4iUH0xft0o0yXEU5T
aQQWSqkVe+o6D5K16J0uHYYiwexugxY8ODqe2FlN1etn3dDh+cYxfcnIRfwmXAUZ
jaMLJsq3ZI8Vv7HeoaHXPrb30/3x0wbCyPn1JN9eIkeHLPClzBQsagchf6oNPl2V
Y0PDWd4S1UouGvyrprEYb1SiW0NFGX3r5d7kFerPkfxhFgK2q54HhjAnaKwNGCEs
P5O/
-----END CERTIFICATE-----
subject=/CN=demo.cinebot.it
issuer=/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3
---
No client certificate CA names sent
Client Certificate Types: RSA sign, DSA sign, ECDSA sign
Requested Signature Algorithms: RSA+SHA512:DSA+SHA512:ECDSA+SHA512:RSA+SHA384:DSA+SHA384:ECDSA+SHA384:RSA+SHA256:DSA+SHA256:ECDSA+SHA256:RSA+SHA224:DSA+SHA224:ECDSA+SHA224:RSA+SHA1:DSA+SHA1:ECDSA+SHA1
Shared Requested Signature Algorithms: RSA+SHA512:DSA+SHA512:ECDSA+SHA512:RSA+SHA384:DSA+SHA384:ECDSA+SHA384:RSA+SHA256:DSA+SHA256:ECDSA+SHA256:RSA+SHA224:DSA+SHA224:ECDSA+SHA224:RSA+SHA1:DSA+SHA1:ECDSA+SHA1
Peer signing digest: SHA512
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 3209 bytes and written 467 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: D04D2367E24D5E1CE3C3298D0935AB8A87D71F84E957B4C411DF5CEB7ED4BDC2
Session-ID-ctx:
Master-Key: 5545400EFD2B469E1238230DA078CF076C8841C4F920CB6285AC42A6696144352E15679E62CB05E1F61CDE17EA164A6C
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - 73 f6 d1 d8 ae 33 3c 58-19 87 c5 a1 c6 63 1b bb s....3<X.....c..
0010 - eb bb 49 8b d9 b2 7b 29-25 63 9b 44 0d 59 d8 d8 ..I...{)%c.D.Y..
0020 - 9f 7c a6 aa b3 3d 28 1e-de 6e b6 ce bf 53 e4 23 .|...=(..n...S.#
0030 - 45 f3 b9 ad 06 8b e3 1b-32 d9 60 87 26 dc 5d f6 E.......2.`.&.].
0040 - 68 6c 99 3c a4 4c eb 41-de b6 7b 10 ab d0 6a f7 hl.<.L.A..{...j.
0050 - 5a 22 4b 34 79 6c 10 d0-41 ad 3c 37 f1 5d 87 5a Z"K4yl..A.<7.].Z
0060 - ae ba 1b 99 12 ad 7a 3c-70 d6 43 97 5d 1c 24 64 ......z<p.C.].$d
0070 - f9 8a 9e 60 66 c8 b7 e4-43 8d cd 52 6d 68 f3 5e ...`f...C..Rmh.^
0080 - 30 dc 11 83 91 94 3f a8-a6 5f 57 1f 7b 78 45 00 0.....?.._W.{xE.
0090 - fb 2c ed ee 8d 98 10 01-0b b2 b5 1e 0f ba 35 b9 .,............5.
00a0 - 15 52 3e 26 ee ce cc eb-1f 8e 56 b4 05 45 e5 00 .R>&......V..E..
00b0 - 15 72 92 4a 4f ed 90 bc-f8 2a 01 e7 b0 d9 a4 21 .r.JO....*.....!
Start Time: 1509030652
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
Andrei, this is not an application issue, this application already implements websockets, my issue is something related to L.E. certificate, maybe the container configuration and Chrome because if I switch to HTTP it works, if I use a self-signed certificate it works, if I use firefox it works.
By the way your example application uses WS and not secure WSS.
And perhaps since the sites requests a certificate, your system is failing because it is not providing any cert or maybe not providing an allowed cert. Ensure you have not checked the “Remember this decision” for a bad decision - LOL