Skip to content
Merged
Changes from all 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
27 changes: 22 additions & 5 deletions kinode/src/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ pub async fn http_server(
));

while let Some(km) = recv_in_server.recv().await {
// we *can* move this into a dedicated task, but it's not necessary
handle_app_message(
km,
http_response_senders.clone(),
Expand Down Expand Up @@ -585,10 +584,28 @@ async fn http_handler(
&jwt_secret_bytes,
) {
// redirect to login page so they can get an auth token
return Ok(warp::http::Response::builder()
.status(StatusCode::OK)
.body(login_html.to_string())
.into_response());
if original_path == "" {
return Ok(warp::http::Response::builder()
.status(StatusCode::OK)
.body(login_html.to_string())
.into_response());
} else {
return Ok(warp::http::Response::builder()
.status(StatusCode::TEMPORARY_REDIRECT)
.header(
"Location",
format!(
"{}://{}",
match headers.get("X-Forwarded-Proto") {
Some(proto) => proto.to_str().unwrap_or("http"),
None => "http",
},
host,
),
)
.body(vec![])
.into_response());
}
}
}
}
Expand Down