This is an automated email from the ASF dual-hosted git repository.
zixuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git
The following commit(s) were added to refs/heads/master by this push:
new d92cfd8 Fix 307 redirect errors when connecting to multi-broker
cluster (#503)
d92cfd8 is described below
commit d92cfd815d4454b08bff8802682a4c7fa24008f0
Author: Apurva007 <[email protected]>
AuthorDate: Thu Dec 29 22:23:42 2022 -0800
Fix 307 redirect errors when connecting to multi-broker cluster (#503)
Co-authored-by: Apurva Telang <[email protected]>
---
.../apache/pulsar/manager/zuul/HttpsClientConfiguration.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git
a/src/main/java/org/apache/pulsar/manager/zuul/HttpsClientConfiguration.java
b/src/main/java/org/apache/pulsar/manager/zuul/HttpsClientConfiguration.java
index 0881764..3c7c21c 100644
--- a/src/main/java/org/apache/pulsar/manager/zuul/HttpsClientConfiguration.java
+++ b/src/main/java/org/apache/pulsar/manager/zuul/HttpsClientConfiguration.java
@@ -17,6 +17,7 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.client.LaxRedirectStrategy;
import org.apache.http.ssl.SSLContexts;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@@ -46,6 +47,12 @@ public class HttpsClientConfiguration {
@Bean
public CloseableHttpClient httpClient() throws Exception {
+ LaxRedirectStrategy customLaxRedirectStrategy = new
LaxRedirectStrategy() {
+ @Override
+ protected boolean isRedirectable(final String method) {
+ return true;
+ }
+ };
if (tlsEnabled) {
Resource resource = new FileSystemResource(tlsKeystore);
File trustStoreFile = resource.getFile();
@@ -68,9 +75,10 @@ public class HttpsClientConfiguration {
hostnameVerifier);
return HttpClients.custom()
+ .setRedirectStrategy(customLaxRedirectStrategy)
.setSSLSocketFactory(sslsf)
.build();
}
- return HttpClients.custom().build();
+ return
HttpClients.custom().setRedirectStrategy(customLaxRedirectStrategy).build();
}
}