jackye1995 opened a new issue, #472:
URL: https://github.com/apache/arrow-rs-object-store/issues/472

   **Describe the bug**
   
   After https://github.com/apache/arrow-rs/pull/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())` where `http` is 
an `HttpConnector`.
   
   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**
   
   ```rust
   #[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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to