Skip to content

Commit

Permalink
fix: push index.html if url is root (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmorency authored Oct 2, 2023
1 parent b1c607a commit d35b95f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/http-proxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ fn process_request(http: Arc<Server>, client: Client) -> impl Fn() {

fn handle_get_request(client: &Client, request: Request) {
let mut path = "/http".to_string();
let url = request.url();
let mut url = request.url().to_string();
if url == "/" {
url.push_str("index.html");
}
let maybe_host = request.headers().iter().find(|h| h.field.equiv("host"));
if let Some(host) = maybe_host {
let parts: Vec<_> = host.value.as_str().splitn(2, '.').collect();
Expand Down

0 comments on commit d35b95f

Please sign in to comment.