fix some browser bug
This commit is contained in:
@@ -27,21 +27,16 @@ pub(crate) async fn index(ctx: &ServerContext, _app_state: AppState) -> Result<G
|
||||
|
||||
let hostname = host_header.split(':').next().unwrap_or(host_header);
|
||||
|
||||
log::info!("Index handler - Host header: '{}', hostname: '{}'", host_header, hostname);
|
||||
|
||||
let current_dir = std::env::current_dir()
|
||||
.map_err(|_| GurtError::invalid_message("Failed to get current directory"))?;
|
||||
|
||||
let (frontend_dir, file_name) = if hostname == "search.web" {
|
||||
log::info!("Index handler serving search.html for search.web domain");
|
||||
(current_dir.join("search-engine").join("frontend"), "search.html")
|
||||
} else {
|
||||
log::info!("Index handler serving index.html for domain: '{}'", hostname);
|
||||
(current_dir.join("frontend"), "index.html")
|
||||
};
|
||||
|
||||
let index_path = frontend_dir.join(file_name);
|
||||
log::info!("Index handler attempting to read: '{}'", index_path.display());
|
||||
|
||||
match tokio::fs::read_to_string(&index_path).await {
|
||||
Ok(content) => {
|
||||
|
||||
Reference in New Issue
Block a user