Deploying an online WebGL Game on Github Pages

Hello all!

I’m new to this community and was wondering what the recommended steps are to deploy an online WebGL game on Github Pages. From my understanding, Github Pages is automatically set to https protocol and for websocket communication to work properly, the websocket protocol needs to be secured. I’ve developed a game on Unity using Mirror Networking and from their documentation, the Websocket Transport component requires a Certificate Path and a Certificate password (

Currently my game is deployed on and the server is hosted using AWS EC2 Windows Server. Whenever I try to connect to the server, I get this following error in the browser’s console (short error): SecurityError: The operation is insecure.

Is it possible to request for the SSL cert information in order to get my game to work online publically over WebGL? If not, what would be some good alternatives to get the game running on Github Pages?

Any help would be appreciated. Thanks in advance!

Hi @hlimbo, welcome to the GitHub Support Community!

I don’t think this is possible using GitHub Pages’ SSL certificate I’m afraid. From a quick look over the docs you listed it seems like you’ll need to buy/generate your own SSL certificate for this.

GitHub Pages SSL certificates are managed automatically by GitHub and you’re not able to directly access or set a password on the certificate generated.

Unfortunately that documentation seems to be lacking in exactly how to set this up so I’m not quite sure what to suggest. If they have a support team or forum I’d recommend reaching out for help there.

@thomasshaped I was able to figure out the steps needed to get the online game to run using secured websockets. The Unity Game WebGL client can be statically hosted on Github Pages but you are required to purchase a web domain and server with SSL certification installed. In case anyone needs steps on how to deploy an online game on Github Pages I followed the following steps:

  1. Purchased a web domain on namecheap (I got my domain for ~$9/year)
  2. Purchased a server on DigitalOcean (Ubuntu Linux) for $5/month
  3. SSH into my DigitalOcean Server using Putty for Windows
  4. Installed free SSL Certificate through on the DigitalOcean Server via LetsEncrypt
  5. Once the SSL Certificate got generated on the server, I wrote a simple ExpressJS application that pointed to the certificate path files and enabled HTTPS (Won’t go into detail how to do that here as there are tutorials that can be visited on the web to see)
  6. Started up the ExpressJS server, visited my website, and checked to see if the SSL certificate was installed successfully by clicking on the lock icon of the browser url field)
  7. If successful, it should say Connection is Secure and is Verified by Let’s Encrypt
  8. Shutdown the ExpressJS Server
  9. In the terminal of the DigitalOcean server, I converted SSL certificate using the following command
openssl pkcs12 -export -out cert.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem

where privkey.pem is your private key, cert.pem and chain.pem are the certificate files obtained through certification process.

  1. In Unity, I used the WebSocket Transport component and set the absolute path of where the Certificate path would be located on the DigitalOcean Server as well as the Certificate Password associated when generating a .pfx file for Unity Server build to use for SSL Certification.

  2. Once Unity Server Linux Build is complete, I copied the server over to the DigitalOcean server and run the server.

Amazing! So happy you got it working, and thanks so much for posting the solution for others that might come across this in future :bowing_man: