How to communicate with service using self-signed certificate?

When trying to make a Request to a service that is using a self-signed certificate I get this error:

The certificate for this server is invalid. You might be connecting to a server that is pretending to be [address] which could put your confidential information at risk.

I accessed the same address from a desktop browser on my Mac (Firefox) and exported the certificate from there (as X.509 Certificate with chain (PEM)). I then imported that certificate in iOS and set the root certificate to trusted. Once I did that I could make REST calls to the service in Safari, but Scriptable (and Shortcuts) still give the same error.

How can I work around this?

I am not sure what can be done to circumvent this. I’ve put it on my todo to look into this.