title: Configure https agent to allow only TLS1.2 for outgoing requests
body: <p>I'm making HTTPS connections from a node app, using a client certificate: </p>
  
  <pre><code>var options = { 
      hostname: 'https://my-server.com', 
      port: 443, 
      path: '/', 
      method: 'GET', 
      key: fs.readFileSync('client1-key.pem'), 
      cert: fs.readFileSync('client1-crt.pem'), 
      ca: fs.readFileSync('ca-crt.pem') }; 
  
  var req = https.request(options, res =&gt; { 
      [...]
  }); 
  </code></pre>
  
  <p>Everything is working fine, however I want to add code to ensure only TLS 1.2 connections are allowed. I cannot find any way to configure this in the <a href="https://nodejs.org/api/http.html#http_class_http_agent" rel="noreferrer">https.agent</a> options, or elsewhere. Is it possible to configure this, or do I have to make a connection and then <a href="https://nodejs.org/api/tls.html#tls_tlssocket_getprotocol" rel="noreferrer">query the protocol</a> version, with something like:</p>
  
  <p><code>res.socket.getProtocol() === 'TLSv1.2'</code></p>
  
  <p>and abort the connection if the protocol is not satisfactory?</p>