ACME Managed Device attestation - Unsupported URL error for certifcate URL in finalize Order step

I'm trying to implement managed device attestation, I have written server code in Go. So far, I have been able to implement all the steps except finalizing order by sending the Certificate url in the json response from where the client can download the certificate.

ACME request flow failed at step 8: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSLocalizedDescription=unsupported URL, NSErrorFailingURLStringKey=}

For server, I am using localhost with https. The URL in "certificate" field of json response is working in browser/postman. I am not able to figure out what is the exact the cause of this error. As there is no FailingURLStringKey I suspect there might be some issue with key in the json response. Can anyone point me to the correct direction to figure out what is the issue?

The important keys in the JSON response at this stage are status which must be set to valid, and certificate which must be set to a URL like https://acme.example.com:14000/certZ/43a546b2e4ce98c1 where the cert can be downloaded. Given the error code, it sounds like there was a value for certificate that isn't a correctly formatted URL. Are there any special characters in your URL?

ACME Managed Device attestation - Unsupported URL error for certifcate URL in finalize Order step
 
 
Q