tutu/docs/dev-https.md
thislight 130a989185
All checks were successful
/ depoly (push) Successful in 1m21s
vite: add https variables
Personal note from Rubicon: I am unware that I
originally put the localhost.direct cert files
into the repository. All reference to the files
are now removed.

Sorry for the inconvenience.
2024-10-27 00:22:28 +08:00

1.1 KiB

Set up HTTPS for the dev server

With a valid HTTP server, you can let the other devices access your dev server, with features only available to HTTPS.

You can use localhost.direct certificate for set up local HTTPS server. Any vaild certificate is also allowed.

Download the certs and unpack them. In this document we put them under "tools/cert/".

Create or edit the file ".env.local", this file is ignored by git. Copy the content from ".env":

DEV_SERVER_HTTPS_CERT_BASE=
DEV_SERVER_HTTPS_CERT_PASS=

The DEV_SERVER_HTTPS_CERT_BASE is the basename for your cert. The cert includes two files to work: one's suffix is .key, the other is .crt. The base is the common part of them.

If you have files "tools/cert/localhost.direct.key" and "tools/cert/localhost.direct.crt", the value you need is "tools/cert/localhost.direct".

The DEV_SERVER_HTTPS_CERT_PASS is the password to unlock the key. For the localhost.direct, it's password.

Here is an example:

DEV_SERVER_HTTPS_CERT_BASE=tools/cert/localhost.direct
DEV_SERVER_HTTPS_CERT_PASS=localhost