diff --git a/src/satellite/src/storage/http/headers.rs b/src/satellite/src/storage/http/headers.rs index 5d9b99846..b522036f9 100644 --- a/src/satellite/src/storage/http/headers.rs +++ b/src/satellite/src/storage/http/headers.rs @@ -1,6 +1,8 @@ use crate::storage::constants::ASSET_ENCODING_NO_COMPRESSION; use crate::storage::http::types::HeaderField; +use crate::storage::types::config::StorageConfig; use crate::storage::types::store::{Asset, AssetEncoding, EncodingType}; +use crate::storage::url::matching_urls; use hex::encode; pub fn build_asset_headers( @@ -62,3 +64,15 @@ fn security_headers() -> Vec { HeaderField("Referrer-Policy".to_string(), "same-origin".to_string()), ] } + +pub fn build_config_headers( + requested_path: &str, + StorageConfig { + headers: config_headers, + .. + }: &StorageConfig, +) -> Vec { + matching_urls(requested_path, config_headers).iter() + .flat_map(|(_, headers)| headers.clone()) + .collect() +}