title: Issues in testing REST API using Cypress in corporate env
body: <p>I am working in a corporate environment. I need to test certain APIs using Cypress. The major challenge I have is I need to call APIs which require Client Certificates to be passed. However, the Client Certificates are not being detected by Cypress.</p>
  <p>I followed the steps laid out to for configuring proxy as explained in: <a href="https://docs.cypress.io/guides/references/proxy-configuration#Set-a-proxy-on-Linux-or-macOS" rel="nofollow noreferrer">https://docs.cypress.io/guides/references/proxy-configuration#Set-a-proxy-on-Linux-or-macOS</a></p>
  <p>I am able to test the UI using Cypress in our corporate env.</p>
  <p>However, when testing with REST APIs, i followed the steps here to capture the ClientCertificates as our API use certs for auth.</p>
  <p><a href="https://docs.cypress.io/guides/references/client-certificates" rel="nofollow noreferrer">https://docs.cypress.io/guides/references/client-certificates</a></p>
  <p>But I get a timeout error:
  `CypressError
  cy.request() failed trying to load:</p>
  <p><a href="https://apiendpoint1.com:1234/v1/resourceName" rel="nofollow noreferrer">https://apiendpoint1.com:1234/v1/resourceName</a></p>
  <p>We attempted to make an http request to this URL but the request failed without a response.</p>
  <p>We received this error at the network level:
  Error: Error establishing proxy connection. Response from server was: HTTP/1.1 503 Service Unavailable
  Cache-Control: no-cache
  Pragma: no-cache
  X-XSS-Protection: 1
  Content-Type: text/html; charset=utf-8
  Connection: close
  Content-Length: 935`</p>
  <p>CYPRESS.JSON</p>
  <pre><code>{ &quot;viewportHeight&quot;:1080, &quot;viewportWidth&quot;:1920, &quot;testFiles&quot;: &quot;**/*.{feature,features,js}&quot;, &quot;defaultCommandTimeout&quot;: 60000, &quot;responseTimeout&quot;:120000, &quot;supportFile&quot;: &quot;cypress/support/index.js&quot;, &quot;reporter&quot;:&quot;mochawesome&quot;, &quot;reporterOptions&quot;: { &quot;reportDir&quot;: &quot;cypress/results&quot;, &quot;overwrite&quot;: false, &quot;html&quot;: true, &quot;json&quot;: false }, &quot;pageLoadTimeout&quot;: 120000, &quot;env&quot;: { &quot;testEnv&quot;: &quot;qa&quot;, &quot;apiendpoints&quot;:{ &quot;apiendpoint1&quot;: &quot;https://apiendpoint1.com:1234&quot;, &quot;apiendpoint2&quot;: &quot;https://apiendpoint2.com:1234&quot; } },&quot;clientCertificates&quot;: [ { &quot;url&quot;: &quot;https://apiendpoint1.com:1234&quot;, &quot;ca&quot;: [], &quot;certs&quot;: [ { &quot;pfx&quot;: &quot;cypress/certs/certs.jks&quot;, &quot;passphrase&quot;: &quot;cypress/certs/pass_phrase.txt&quot; } ] }, { &quot;url&quot;: &quot;https://apiendpoint2.com:1234&quot;, &quot;ca&quot;: [], &quot;certs&quot;: [ { &quot;pfx&quot;: &quot;cypress/certs/certs.jks&quot;, &quot;passphrase&quot;: &quot;cypress/certs/pass_phrase.txt&quot; } ] } ] }
  </code></pre>
  <p>SPEC.JS</p>
  <pre><code>describe(&quot;SampleTest&quot;, () =&gt; {
  it('gives a response matching a fixture object', () =&gt; {
  let requestBody = &quot;{ 'name':'nameValue','address':'addressVal'}&quot;;
  cy.request({
  method: 'POST',
  url: Cypress.env(&quot;apiendpoints&quot;).apiendpoint1 + &quot;v1/resourceName&quot;,
  body: requestBody
  })
  .then((response) =&gt; {
  expect(response.body).to.have.property('code', 200);
  })
  })
  
  })
  </code></pre>
  <p>Environment Variables:</p>
  <pre><code>HTTPS_PROXY=http://corporateproxy.com:443/
  HTTP_PROXY=http://corporateproxy..com:80/
  NODE_EXTRA_CA_CERTS=C:\Users\usrname.dotfiles\bundle.crt
  NODE_HOME=C:\Program Files\nodejs
  NODE_TLS_REJECT_UNAUTHORIZED=0
  NO_PROXY=*.apiendpoint1.com, *.apiendpoint2.com
  </code></pre>