fix:add favicon.ico route (#713)

This commit is contained in:
weisd
2025-10-25 16:11:18 +08:00
committed by GitHub
parent 6a59c0a474
commit ed73e2b782
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -237,7 +237,7 @@ pub(crate) fn init_telemetry(config: &OtelConfig) -> OtelGuard {
match metrics_exporter_opentelemetry::Recorder::builder("order-service").install_global() { match metrics_exporter_opentelemetry::Recorder::builder("order-service").install_global() {
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
eprintln!("Failed to set global metrics recorder: {:?}", e); eprintln!("Failed to set global metrics recorder: {e:?}");
} }
} }
+2 -1
View File
@@ -387,7 +387,7 @@ fn get_console_config_from_env() -> (bool, u32, u64, String) {
} }
pub fn is_console_path(path: &str) -> bool { pub fn is_console_path(path: &str) -> bool {
path.starts_with(CONSOLE_PREFIX) path == "/favicon.ico" || path.starts_with(CONSOLE_PREFIX)
} }
/// Setup comprehensive middleware stack with tower-http features /// Setup comprehensive middleware stack with tower-http features
@@ -398,6 +398,7 @@ fn setup_console_middleware_stack(
auth_timeout: u64, auth_timeout: u64,
) -> Router { ) -> Router {
let mut app = Router::new() let mut app = Router::new()
.route("/favicon.ico", get(static_handler))
.route(&format!("{CONSOLE_PREFIX}/license"), get(license_handler)) .route(&format!("{CONSOLE_PREFIX}/license"), get(license_handler))
.route(&format!("{CONSOLE_PREFIX}/config.json"), get(config_handler)) .route(&format!("{CONSOLE_PREFIX}/config.json"), get(config_handler))
.route(&format!("{CONSOLE_PREFIX}/health"), get(health_check)) .route(&format!("{CONSOLE_PREFIX}/health"), get(health_check))
+1 -2
View File
@@ -31,7 +31,6 @@ use tower::Service;
use tracing::error; use tracing::error;
use crate::admin::ADMIN_PREFIX; use crate::admin::ADMIN_PREFIX;
use crate::admin::console::CONSOLE_PREFIX;
use crate::admin::console::is_console_path; use crate::admin::console::is_console_path;
use crate::admin::console::make_console_server; use crate::admin::console::make_console_server;
use crate::admin::rpc::RPC_PREFIX; use crate::admin::rpc::RPC_PREFIX;
@@ -99,7 +98,7 @@ where
} }
} }
uri.path().starts_with(ADMIN_PREFIX) || uri.path().starts_with(RPC_PREFIX) || uri.path().starts_with(CONSOLE_PREFIX) uri.path().starts_with(ADMIN_PREFIX) || uri.path().starts_with(RPC_PREFIX) || is_console_path(uri.path())
} }
// check_access before call // check_access before call