-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Describe the bug
After apache/arrow-rs#7183, the request to IMDS no longer uses the reqwest client directly to make request, but instead now goes through http.connect(&self.client_options.metadata_options()) which gives a HttpClient.
Looks like when making a request to IMDS to get credentials, the header is overridden, so original headers like User-Agent set by the user will be dropped. This causes access issue when the IMDS server is behind a corporate firewall.
To Reproduce
#[test]
fn test_issue() {
use object_store::client::{ClientOptions, HttpClient};
use http::{Method, HeaderValue};
let options = ClientOptions::new()
.with_user_agent(HeaderValue::from_static("my-test-app/1.0"));
let reqwest_client = options.client().unwrap();
let http_client = HttpClient::new(reqwest_client);
let request = http_client
.request(Method::GET, "http://169.254.169.254/latest/meta-data/")
.build()
.unwrap();
let has_user_agent = request.headers().contains_key("user-agent");
// fails here
assert!(has_user_agent)
}Expected behavior
Should preserve the original headers
Additional context
I will put up a PR later with more details
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested