ChrisInEdmonton
ChrisInEdmonton

Reputation: 4578

Turn off SSL certificate verification in Ruby

When using 'net/https' and ssl, how do I disable verification of the resulting SSL certificate?

Upvotes: 11

Views: 20810

Answers (1)

ChrisInEdmonton
ChrisInEdmonton

Reputation: 4578

The following code will disable verification of the certificate. Note that this necessarily implies that invalid certificates will be accepted.

http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl?

Upvotes: 23

Related Questions