mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
fix(console): handle apple touch icon paths (#5214)
This commit is contained in:
@@ -22,8 +22,9 @@ use crate::server::rate_limit::{
|
||||
apply_throttle_headers, client_ip,
|
||||
};
|
||||
use crate::server::{
|
||||
CONSOLE_PREFIX, FAVICON_PATH, HEALTH_PREFIX, HEALTH_READY_PATH, HeaderMapCarrier, HealthProbe, LICENSE, RUSTFS_ADMIN_PREFIX,
|
||||
RequestContextLayer, VERSION, build_health_response_parts, collect_probe_readiness,
|
||||
APPLE_TOUCH_ICON_PATH, APPLE_TOUCH_ICON_PRECOMPOSED_PATH, CONSOLE_PREFIX, FAVICON_PATH, HEALTH_PREFIX, HEALTH_READY_PATH,
|
||||
HeaderMapCarrier, HealthProbe, LICENSE, RUSTFS_ADMIN_PREFIX, RequestContextLayer, VERSION, build_health_response_parts,
|
||||
collect_probe_readiness,
|
||||
};
|
||||
use crate::version::build;
|
||||
use axum::{
|
||||
@@ -470,7 +471,8 @@ fn get_console_config_from_env() -> (bool, u32, u64, String) {
|
||||
/// # Returns:
|
||||
/// - `true` if the path is for console access, `false` otherwise.
|
||||
pub fn is_console_path(path: &str) -> bool {
|
||||
path == FAVICON_PATH || has_path_prefix(path, CONSOLE_PREFIX)
|
||||
matches!(path, FAVICON_PATH | APPLE_TOUCH_ICON_PATH | APPLE_TOUCH_ICON_PRECOMPOSED_PATH)
|
||||
|| has_path_prefix(path, CONSOLE_PREFIX)
|
||||
}
|
||||
|
||||
/// Setup comprehensive middleware stack with tower-http features
|
||||
@@ -874,6 +876,8 @@ mod tests {
|
||||
#[test]
|
||||
fn external_admin_paths_are_not_console_paths() {
|
||||
assert!(is_console_path("/rustfs/console/"));
|
||||
assert!(is_console_path("/apple-touch-icon.png"));
|
||||
assert!(is_console_path("/apple-touch-icon-precomposed.png"));
|
||||
assert!(!is_console_path("/minio/admin/v3/info"));
|
||||
assert!(!is_console_path("/rustfs/admin/v3/info"));
|
||||
}
|
||||
|
||||
@@ -65,10 +65,11 @@ pub(crate) use module_switch::{
|
||||
save_persisted_module_switches_to, validate_module_switch_update,
|
||||
};
|
||||
pub(crate) use prefix::{
|
||||
ADMIN_PREFIX, CONSOLE_PREFIX, FAVICON_PATH, HEALTH_COMPAT_LIVE_PATH, HEALTH_PREFIX, HEALTH_READY_PATH, LICENSE,
|
||||
MINIO_ADMIN_PREFIX, MINIO_ADMIN_V3_PREFIX, MINIO_HEALTH_CLUSTER_PATH, MINIO_HEALTH_CLUSTER_READ_PATH, MINIO_HEALTH_LIVE_PATH,
|
||||
MINIO_HEALTH_READY_PATH, PROFILE_CPU_PATH, PROFILE_MEMORY_PATH, RPC_PREFIX, RUSTFS_ADMIN_PREFIX, TABLE_CATALOG_COMPAT_PREFIX,
|
||||
TABLE_CATALOG_PREFIX, TONIC_PREFIX, VERSION, has_path_prefix, is_admin_path, is_table_catalog_path,
|
||||
ADMIN_PREFIX, APPLE_TOUCH_ICON_PATH, APPLE_TOUCH_ICON_PRECOMPOSED_PATH, CONSOLE_PREFIX, FAVICON_PATH,
|
||||
HEALTH_COMPAT_LIVE_PATH, HEALTH_PREFIX, HEALTH_READY_PATH, LICENSE, MINIO_ADMIN_PREFIX, MINIO_ADMIN_V3_PREFIX,
|
||||
MINIO_HEALTH_CLUSTER_PATH, MINIO_HEALTH_CLUSTER_READ_PATH, MINIO_HEALTH_LIVE_PATH, MINIO_HEALTH_READY_PATH, PROFILE_CPU_PATH,
|
||||
PROFILE_MEMORY_PATH, RPC_PREFIX, RUSTFS_ADMIN_PREFIX, TABLE_CATALOG_COMPAT_PREFIX, TABLE_CATALOG_PREFIX, TONIC_PREFIX,
|
||||
VERSION, has_path_prefix, is_admin_path, is_table_catalog_path,
|
||||
};
|
||||
pub(crate) use readiness::DependencyReadiness;
|
||||
pub(crate) use readiness::DependencyReadinessReport;
|
||||
|
||||
@@ -22,6 +22,8 @@ pub(crate) const PROFILE_MEMORY_PATH: &str = "/profile/memory";
|
||||
/// Favicon path to handle browser requests for the favicon.
|
||||
/// This path serves the favicon.ico file.
|
||||
pub(crate) const FAVICON_PATH: &str = "/favicon.ico";
|
||||
pub(crate) const APPLE_TOUCH_ICON_PATH: &str = "/apple-touch-icon.png";
|
||||
pub(crate) const APPLE_TOUCH_ICON_PRECOMPOSED_PATH: &str = "/apple-touch-icon-precomposed.png";
|
||||
|
||||
/// Predefined health check path for RustFS server.
|
||||
/// This path is used to check the health status of the server.
|
||||
|
||||
Reference in New Issue
Block a user