mrafiqk / html-pdf-node

187 stars 119 forks source link

"Error: self-signed certificate" when using references to internal webserver hosting css and js files #104

Open NoraTheExplorer opened 11 months ago

NoraTheExplorer commented 11 months ago

Setup:

Now, when using html in the header like this. <script src="https://myserver.mydomain.local:8080/quote/dev/assets/js/vyquote.js" crossorigin="anonymous" X-Content-Type-Options="no-sniff" defer></script> <!-- defer is needed to wait with the script until the HTML is fully loaded --> <link rel="stylesheet" href="https://myserver.mydomain.local:8080/quote/dev/assets/font/gilroy-regular/stylesheet.css" crossorigin="anonymous">

I get this error when calling generatePdf(file, options):

Error: self-signed certificate at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34) at TLSSocket.emit (node:events:513:28) at TLSSocket._finishInit (node:_tls_wrap:959:8) at ssl.onhandshakedone (node:_tls_wrap:743:12) { code: 'DEPTH_ZERO_SELF_SIGNED_CERT', response: undefined }

Even though I configured my options like this: let options = { format: 'A4', preferCSSPageSize: true, printBackground: true, args: ['--no-sandbox', '--disable-setuid-sandbox', '--allow-insecure-localhost','--disable-machine-cert-request'] };