Skip to content

Instantly share code, notes, and snippets.

@hyoretsu
Last active May 30, 2021 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyoretsu/98ef7ff0357b02a15628de284777eaba to your computer and use it in GitHub Desktop.
Save hyoretsu/98ef7ff0357b02a15628de284777eaba to your computer and use it in GitHub Desktop.
How to run HTTPS in development with WSL2
  1. Download OpenSSL for Windows from https://slproweb.com/products/Win32OpenSSL.html
  2. Add whichever folder you selected for binaries to your PATH
  3. Create a file named example.conf and paste this
[req]
default_bits = 2048
prompt = no
default_md = sha256
x509_extensions = v3_req
distinguished_name = dn

[dn]
C = YOUR_COUNTRY_CODE
ST = YOUR_STATE
L = YOUR_CITY
O = .
OU = .
emailAddress = YOUR_EMAIL
CN = YOUR_NICKNAME

[v3_req]
subjectAltName = @alt_names

[alt_names]
DNS.1 = localhost
  1. Open a terminal window in the same folder as example.conf and run the following command openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout private.key -days 36525 -out private.crt -config example.cnf
  2. Go to Chrome's Settings>Security>Manage certificates>Import and make sure Trusted Root Certification Authorities is selected
  3. Move private.crt and private.key to your WSL installation (anywhere) and link them in your webpack.config.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment