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 ...