Fix path prefixes
This commit is contained in:
parent
c49b2075a3
commit
8d47bef9d4
2 changed files with 5 additions and 3 deletions
|
@ -99,7 +99,7 @@ fn parse_tricot_tag(
|
||||||
}
|
}
|
||||||
|
|
||||||
let (host, path_prefix) = match splits[1].split_once('/') {
|
let (host, path_prefix) = match splits[1].split_once('/') {
|
||||||
Some((h, p)) => (h, Some(p.to_string())),
|
Some((h, p)) => (h, Some(format!("/{}", p))),
|
||||||
None => (splits[1], None),
|
None => (splits[1], None),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,9 @@ fn create_proxied_request<B>(
|
||||||
|
|
||||||
*builder.headers_mut().unwrap() = remove_hop_headers(request.headers());
|
*builder.headers_mut().unwrap() = remove_hop_headers(request.headers());
|
||||||
|
|
||||||
let host_header_name = "host";
|
|
||||||
let x_forwarded_for_header_name = "x-forwarded-for";
|
|
||||||
|
|
||||||
// If request does not have host header, add it from original URI authority
|
// If request does not have host header, add it from original URI authority
|
||||||
|
let host_header_name = "host";
|
||||||
if let Some(authority) = request.uri().authority() {
|
if let Some(authority) = request.uri().authority() {
|
||||||
if let hyper::header::Entry::Vacant(entry) =
|
if let hyper::header::Entry::Vacant(entry) =
|
||||||
builder.headers_mut().unwrap().entry(host_header_name)
|
builder.headers_mut().unwrap().entry(host_header_name)
|
||||||
|
@ -85,6 +84,7 @@ fn create_proxied_request<B>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add forwarding information in the headers
|
// Add forwarding information in the headers
|
||||||
|
let x_forwarded_for_header_name = "x-forwarded-for";
|
||||||
match builder
|
match builder
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -100,6 +100,8 @@ fn create_proxied_request<B>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder.headers_mut().unwrap().insert(HeaderName::from_bytes(b"x-forwarded-proto")?, "https".try_into()?);
|
||||||
|
|
||||||
if let Some(conn) = request.headers().get("connection") {
|
if let Some(conn) = request.headers().get("connection") {
|
||||||
if conn.to_str()?.to_lowercase() == "upgrade" {
|
if conn.to_str()?.to_lowercase() == "upgrade" {
|
||||||
if let Some(upgrade) = request.headers().get("upgrade") {
|
if let Some(upgrade) = request.headers().get("upgrade") {
|
||||||
|
|
Loading…
Reference in a new issue