Score:0

Can't connect to WebSocket server over wss:// (ws:// works), and no debug information

th flag

I have a website on example.com, and a WebSocket server on example-websocket-server.com.

Each have an SSL certificate so that I can access them from https://

I am using the websocket server as a websocket server for all the other websites, including example.com (there are more websites). However the wss:// connection fails (ws:// works).

The websocket server uses Laravel-Websocket as the server and it asks for a path to the PEM certificate: https://beyondco.de/docs/laravel-websockets/basic-usage/ssl#configuration:

/*
 * Path to local certificate file on filesystem. It must be a PEM encoded file which
 * contains your certificate and private key. It can optionally contain the
 * certificate chain of issuers. The private key also may be contained
 * in a separate file specified by local_pk.
 */

So for that PEM certificate I used the same certificate as the https:// certificate I am using on IIS

However I have a few issues - the certificate I am using on IIS was a .pfx file, with a given password string.

In order to create the PEM file used for the websocket server's wss connection, I first exported the .pfx to the PKCS7 file (.p7b), and then used OpenSSL to convert it to a .cer file. When I change the extension from .cer to .pem the file content look like that:

-----BEGIN PKCS7-----
[..long string..]
-----END PKCS7-----

(I tried using the file both as a .cer and .pem just in case)

But now the wss:// fails, and there is no debug information so I have no idea what is the cause. And in my case it can be multiple:

  1. I am using the wrong certificate
  2. The conversion I did from the .pfx to the .cer/.pem is wrong
  3. There is cross-origin restriction on my app side (Laravel) and that's the problem because the websockets server and the website are on different URLs (but less likely because it works with ws)
  4. Some configuration for WSS in IIS (Although normal ws:// connection worked)
  5. PKCS7 is not compatible and I need PKCS12?

Or other thing I did not think of yet

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.