Worker fails to connect to external Node.js server with mTLS

For Workers & Pages, what is the name of the domain?


What is the error number?

520

What is the issue or error you’re encountering

My worker fails to connect to an external Node.js server using a client certificate and fetch().

What are the steps to reproduce the issue?

  • Set up a Node.js HTTPS server that expects a client certificate
  • On the worker side, upload the client certificate and key with: wrangler mtls-certificate upload
  • In the worker code, do a fetch() with the certificate:
    export default {
    async fetch(request, environment) {
    await environment.MY_CERT.fetch(“https://some-domain.com:55321”)
    }
    }
  • When running the worker, the following SSL error appears on the Node.js server side: SSL routines:tls_process_client_certificate:peer did not return a certificate
  • The fetch() returns a 520 error code

This topic was automatically closed after 15 days. New replies are no longer allowed.