domain safe
This commit is contained in:
@@ -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()
|
||||
}))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user