← Timeout | HTTPS Configurations(中文) | Proxy Configurations →
request.setSysProtocol(com.aliyuncs.http.ProtocolType.HTTPS);
Priority: Client > Default
- Ignore certificate
This must be set when the project first creates the client.
Otherwise you need to close the last client with the command ApacheHttpClient.getInstance().close()
.
// Client HTTPS configurations
HttpClientConfig clientConfig = HttpClientConfig.getDefault();
// Configure not to verify the server certificates
clientConfig.setIgnoreSSLCerts(true);
IClientProfile profile = DefaultProfile.getProfile(regionId, accesskeyId, accesskeySecret);
profile.setHttpClientConfig(clientConfig);
DefaultAcsClient client = new DefaultAcsClient(profile);
- Customize the configuration of certificate validation
KeyManager
and X509TrustManager
are the interface. User implementation is required.
// Client HTTPS configurations
HttpClientConfig clientConfig = HttpClientConfig.getDefault();
// Configure user-defined TrustManagers
clientConfig.setX509TrustManagers(clientTrustManagers);
// Configure user-defined KeyManagers
clientConfig.setKeyManagers(clientKeyManagers);
IClientProfile profile = DefaultProfile.getProfile(regionId, accesskeyId, accesskeySecret);
profile.setHttpClientConfig(clientConfig);
DefaultAcsClient client = new DefaultAcsClient(profile);
← Timeout | HTTPS Configurations(中文) | Proxy Configurations →