O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

Once we run the program, the HTTPS server will start locally listening on port 8443.  

Browsing https://localhost:8443/ will give us Hello World! as a response from the server:

 Moreover, executing a GET request from the command line passing the --insecure flag with curl will skip the certificate validation, as we are using a self-signed certificate:

$ curl -X GET https://localhost:8443/ --insecure Hello World!

Let's understand the program we have written:

  • const (CONN_HOST = "localhost" CONN_PORT = "8443" HTTPS_CERTIFICATE = "domain.crt" DOMAIN_PRIVATE_KEY = "domain.key"): Here, we declared four constants - CONN_HOST with the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required