mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-23 00:21:38 +03:00
pronto proto
This commit is contained in:
parent
84738b7b5b
commit
e2209f8b38
@ -378,9 +378,18 @@ async fn login_handler(
|
|||||||
Ok(v) => {
|
Ok(v) => {
|
||||||
response.headers_mut().append("set-cookie", v);
|
response.headers_mut().append("set-cookie", v);
|
||||||
if let Some(redirect) = query_params.get("redirect") {
|
if let Some(redirect) = query_params.get("redirect") {
|
||||||
|
// get http/https from request headers
|
||||||
|
let proto = match response.headers().get("X-Forwarded-Proto") {
|
||||||
|
Some(proto) => proto.to_str().unwrap_or("http").to_string(),
|
||||||
|
None => "http".to_string(),
|
||||||
|
};
|
||||||
|
|
||||||
response.headers_mut().append(
|
response.headers_mut().append(
|
||||||
"Location",
|
"Location",
|
||||||
HeaderValue::from_str(&format!("http://{}{redirect}", host.unwrap()))
|
HeaderValue::from_str(&format!(
|
||||||
|
"{proto}://{}{redirect}",
|
||||||
|
host.unwrap()
|
||||||
|
))
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
response
|
response
|
||||||
|
Loading…
Reference in New Issue
Block a user