Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the https functionality broken from rustls upgrade #3764

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/cli/src/serve/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,16 @@ impl Output {
);

self.render_feature_list(frame, app_features, state);

// todo(jon) should we write https ?
// Render the server address
let address = match state.server.displayed_address() {
Some(address) => format!("http://{}", address).blue(),
Some(address) => {
if state.krate.config.web.https.enabled.unwrap_or_default() {
format!("https://{}", address).blue()
} else {
format!("http://{}", address).blue()
}
}
None => "no server address".dark_gray(),
};

Expand Down
9 changes: 9 additions & 0 deletions packages/cli/src/serve/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use tower_http::{
services::fs::{ServeDir, ServeFileSystemResponseBody},
ServiceBuilderExt,
};
use rustls::crypto::ring;

/// The webserver that serves statics assets (if fullstack isn't already doing that) and the websocket
/// communication layer that we use to send status updates and hotreloads to the client.
Expand Down Expand Up @@ -120,6 +121,14 @@ impl WebServer {
build_status.clone(),
)?;

// Optionally need to initialize the default crypto provider before we start the server
// https://github.com/rustls/rustls/issues/1938
if krate.config.web.https.enabled.unwrap_or_default() {
ring::default_provider()
.install_default()
.expect("Failed to install rustls crypto provider");
}

// And finally, start the server mainloop
tokio::spawn(devserver_mainloop(
krate.config.web.https.clone(),
Expand Down
Loading