stackvana / microcule

SDK and CLI for spawning streaming stateless HTTP microservices in multiple programming languages
Other
480 stars 29 forks source link

Support https connections #37

Closed brucehvn closed 7 years ago

brucehvn commented 7 years ago

I was trying to use microcule to run a google assistant example that was designed to run on GCF. However, the API.AI webhooks require an https connection. Looks like microcule is hard coded to start only http servers. Could it be enhanced to have the option of using the https module for starting the server?

This link documents the API.AI webhook requirements.

Marak commented 7 years ago

microcule is a collection of HTTP middlewares, so it should be trivial to use it inside an HTTPS server.

The hard-coded part you see is for the microcule binary which is shipped for connivence. This should be easy to update to add HTTPS option.

Marak commented 7 years ago

I added some documentation about adding SSL keys.

It seems it was already supported through configuration options to the http package we are using.

https://github.com/stackvana/microcule#ssl

Should be as simple as adjusting configuration as following:

{
  http: {
    https: true, // enables https / ssl, requires key, cert, ca
    key: "ssl key as string",
    cert: "ssl cert as string",
    ca: "ssl ca as string",
    sslRequired: false, // redirects all http traffic to https, optional
    onlySSL: false // will only start https server with no unprotected http interface, optional
  }
}