All Products
Search
Document Center

Alibaba Cloud SDK:Configure SSL authentication

Last Updated:Feb 23, 2022

Configure SSL authentication

Introduction

You can configure SSL authentication for requests.

  • If you set HTTPSInsecure to true, SSL authentication is disabled. This setting may cause risks. We recommend that you enable SSL authentication.

  • If you set HTTPSInsecure to false, SSL authentication is enabled. By default, the certificate authority (CA) certificate of the OS is used.

Default value

  • The default value of HTTPSInsecure is false.

Enable SSL authentication

// If you configure HTTPSInsecure for a request, the setting takes effect only on the current request.
request.SetHTTPSInsecure(true)                           // Set HTTPSInsecure to true for the request.
isInsecure := request.GetHTTPSInsecure()                 // Query the setting of HTTPSInsecure for the request.

If you do not configure HTTPSInsecure for a request, the setting for a client takes effect.

// If you configure HTTPSInsecure for the client, the setting takes effect on all requests that are initiated by the client. 
client.SetHTTPSInsecure(true)                         // Set HTTPSInsecure to true for the client.
isInsecure := client.GetHTTPSInsecure()               // Query the setting of HTTPSInsecure for the client.