Enabling SSL on Mongoose http server



pstrReturn = mg_set_option(serverHttps, "listening_port", "ssl://443:ssl.pem");  // Open port 443 with ssl.pem certificate


# openssl version
OpenSSL 1.0.0-beta2 21 Apr 2009

# openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 1000 -nodes

# cat key.pem > ssl.pem; cat cert.pem >> ssl.pem

Testing mongoose server via command line (curl), Switch -k allow to use self-signed certificates.

curl -X OPTIONS --header "Access-Control-Request-Method:GET" --header "Access-Control-Request-Headers: accept, x-coral-api-key" https://server.a18/v1/service/method -k

Leave a Reply

Your email address will not be published. Required fields are marked *