Skip to content

Support HTTPS when serving locally #709

Description

@nuzzles

For me, this is absolutely crucial because my web app checks cookies on startup, which must exist to continue the app.

Cookies are very special, and can only be retrieved on the same domain with Javascript/wasm bindings.

Hence, I need to serve my application with self-signed certs.

This is my typical workflow:

Create an /etc/hosts entry:

127.0.0.1   localhost.mydomain.com

Create local certs:

brew install mkcert
brew install nss
mkcert -install
mkcert -key-file ~/.cert/mydomain-key.pem -cert-file ~/.cert/mydomain-cert.pem localhost.mydomain.com

Then, I serve with Trunk:

[serve]
addresses = ["127.0.0.1"]
port = 3000
aliases = ["https://localhost.mydomain.com"]
ws_protocol = "wss"
tls_key_path = "~/.cert/mydomain-key.pem"
tls_cert_path = "~/.cert/mydomain-cert.pem"

This would serve on https://localhost.mydomain.com:3000, and hence my bevy app can load cookies properly for the .mydomain.com path

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions