Skip to content

Commit

Permalink
doc change (node just deleted their docs on https)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jan 12, 2023
1 parent 9d0891f commit 5be36b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,19 @@ At a high level, the breaking changes in this release fix some long-standing iss

To enable HTTPS with esbuild:

1. Generate a self-signed certificate (Node's documentation has some [instructions with example commands](https://nodejs.org/en/knowledge/HTTP/servers/how-to-create-a-HTTPS-server/))
1. Generate a self-signed certificate. There are many ways to do this. Here's one way, assuming you have `openssl` installed:
```
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 9999 -nodes -subj /CN=127.0.0.1
```
2. Add `--keyfile=key.pem` and `--certfile=cert.pem` to your esbuild development server command
3. Click past the scary warning in your browser when you load your page
If you have more complex needs than this, you can still put a proxy in front of esbuild and use that for HTTPS instead. Note that if you see the message "Client sent an HTTP request to an HTTPS server" when you load your page, then you are using the incorrect protocol. Replace `http://` with `https://` in your browser's URL bar.

Keep in mind that esbuild's HTTPS support has nothing to do with security. The only reason esbuild now supports HTTPS is because browsers have made it impossible to do local development with certain modern web features without jumping through these extra hoops. *Please do not use esbuild's development server for anything that needs to be secure.* It's only intended for local development and no considerations have been made for production environments whatsoever.
* Fix `onEnd` not being called in serve mode ([#1384](https://github.com/evanw/esbuild/issues/1384))
Previous releases had a bug where plugin `onEnd` callbacks weren't called when using the top-level `serve()` API. This API no longer exists and the internals have been reimplemented such that `onEnd` callbacks should now always be called at the end of every build.
Expand Down
5 changes: 1 addition & 4 deletions scripts/js-api-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3840,10 +3840,7 @@ let serveTests = {

const keyfile = path.join(testDir, 'key.pem')
const certfile = path.join(testDir, 'cert.pem')
const requestFile = path.join(testDir, 'csr.pem')
await run(['openssl', 'genrsa', '-out', keyfile])
await run(['openssl', 'req', '-new', '-key', keyfile, '-out', requestFile, '-subj', '/CN=127.0.0.1'])
await run(['openssl', 'x509', '-req', '-days', '9999', '-in', requestFile, '-signkey', keyfile, '-out', certfile])
await run(['openssl', 'req', '-x509', '-newkey', 'rsa:4096', '-keyout', keyfile, '-out', certfile, '-days', '9999', '-nodes', '-subj', '/CN=127.0.0.1'])

const input = path.join(testDir, 'in.js')
await writeFileAsync(input, `console.log(123)`)
Expand Down

0 comments on commit 5be36b8

Please sign in to comment.