domain safe

This commit is contained in:
Simon
2025-09-29 15:01:25 +00:00
parent 661a28b6ac
commit 39acd8ef96
2 changed files with 33 additions and 7 deletions

View File

@@ -62,9 +62,14 @@ async fn main() -> std::io::Result<()> {
.service(web::scope("/proxy").configure(proxy::config))
.service(
web::resource("/")
.route(web::get().to(|| async {
.route(web::get().to(|req: web::HttpRequest| async move{
let host = match std::env::var("DOMAIN"){
Ok(d) => d,
Err(_) => req.connection_info().host().to_string()
};
let source_forward_header = format!("hottub://source?url={}", host);
web::HttpResponse::Found()
.header("Location", "hottub://source?url=hottub.spacemoehre.de")
.header("Location", source_forward_header)
.finish()
}))
)