akhilputhiry commented on code in PR #12406:
URL: https://github.com/apache/iceberg/pull/12406#discussion_r1984518742


##########
core/src/main/java/org/apache/iceberg/rest/RESTCatalog.java:
##########
@@ -55,7 +56,22 @@ public class RESTCatalog
   public RESTCatalog() {
     this(
         SessionCatalog.SessionContext.createEmpty(),
-        config -> 
HTTPClient.builder(config).uri(config.get(CatalogProperties.URI)).build());
+        config -> {
+          HTTPClient.Builder builder =
+              
HTTPClient.builder(config).uri(config.get(CatalogProperties.URI));
+
+          boolean proxyEnabled =
+              PropertyUtil.propertyAsBoolean(
+                  config, CatalogProperties.PROXY_ENABLED, 
CatalogProperties.PROXY_ENABLED_DEFAULT);
+
+          if (proxyEnabled) {
+            builder.withProxy(
+                config.get(CatalogProperties.PROXY_HOSTNAME),
+                Integer.parseInt(config.get(CatalogProperties.PROXY_PORT)));
+          }
+
+          return builder.build();

Review Comment:
   @adutra Thanks for the feedback
   
   For point 3, I have added support for simple auth for now, we can add other 
mechanisms in follow up PRs
   
   For point 2, I shall try the following. 
   
   we could use the 
[ProxyRoutePlanner](https://hc.apache.org/httpcomponents-client-5.4.x/current/apidocs/org/apache/hc/client5/http/impl/routing/DefaultProxyRoutePlanner.html)
 to use different proxies for different domains
   
   The confs would look something like the following, we can adjust the 
`domains` parameter so that proxy will be selected accordingly
   
   ```
   conf.set("spark.sql.catalog.demo.proxy.myproxy1.hostname", "127.0.0.1")
   conf.set("spark.sql.catalog.demo.proxy.myproxy1.port", "8080")
   conf.set("spark.sql.catalog.demo.proxy.myproxy1.requires-credentials", 
"true")
   conf.set("spark.sql.catalog.demo.proxy.myproxy1.username", "ac")
   conf.set("spark.sql.catalog.demo.proxy.myproxy1.password", "dc")
   conf.set("spark.sql.catalog.demo.proxy.myproxy1.domains", "*")
   conf.set("spark.sql.catalog.demo.proxy.myproxy1.priority", "1")
   
   conf.set("spark.sql.catalog.demo.proxy.myproxy2.hostname", "127.0.0.1")
   conf.set("spark.sql.catalog.demo.proxy.myproxy2.port", "9090")
   conf.set("spark.sql.catalog.demo.proxy.myproxy2.requires-credentials", 
"true")
   conf.set("spark.sql.catalog.demo.proxy.myproxy2.username", "ac")
   conf.set("spark.sql.catalog.demo.proxy.myproxy2.password", "dc")
   conf.set("spark.sql.catalog.demo.proxy.myproxy2.domains", "*")
   conf.set("spark.sql.catalog.demo.proxy.myproxy2.priority", "2")
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to