Skip to content

Location header seems to not be working #94

@steveklabnik

Description

@steveklabnik

was trying to implement a workaround for #88 :

pub fn serve(directory: &Path) -> Result<()> {
    let host = "127.0.0.1";
    let port = "7878";

    let server = Server::new(|request, mut response| {
        println!("got {}", request.uri().path());
        response.status(301);
        response.header(http::header::LOCATION, "/index.html".as_bytes());
        Ok(response.body("".as_bytes())?)
    });

    env::set_current_dir(directory)?;

    println!("serving at http://{}:{}", host, port);

    server.listen(host, port);

    Ok(())
}

the 301 comes through, but not the location header. I don't know why...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions