Consider a small program:
package main
import (
"fmt"
"net/http"
_ "github.com/stealthrocket/net/http"
)
func main() {
resp, err := http.Get("https://example.com")
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Println("Status:", resp.Status)
}
Build and run with wasi-go:
GOOS=wasip1 GOARCH=wasm go build --tags getaddrinfo -o app.wasm
wasmrun app.wasm
Result:
Error: Get "https://example.com": tls: failed to verify certificate: x509: certificate signed by unknown authority
If I manually add the root certificates using a package like github.com/breml/rootcerts, then it works. Is that a requirement? Or is there some way to configure wasi-go to use the host's root certificates? I did try --dir=/ but that didn't help. Thanks.
Consider a small program:
Build and run with wasi-go:
Result:
If I manually add the root certificates using a package like github.com/breml/rootcerts, then it works. Is that a requirement? Or is there some way to configure wasi-go to use the host's root certificates? I did try
--dir=/but that didn't help. Thanks.