GoogleCloudPlatform / functions-framework

The Contract for Building New Function Frameworks
Apache License 2.0
123 stars 11 forks source link

Custom SSL Cert #35

Closed grant closed 3 years ago

grant commented 4 years ago

Summary

Provide an option for a developer to bring your own SSL key/cert:

Examples

What we'd do in the Function Frameworks (very roughly):

Go:

    srv := &http.Server{
        Addr:         ":443",
        Handler:      mux,
        TLSConfig:    cfg,
        TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler), 0),
    }
    log.Fatal(srv.ListenAndServeTLS(os.Getenv("FUNCTION_SSL_KEY"), os.Getenv("FUNCTION_SSL_CERT")))

Node:

const options = {
  key: fs.readFileSync(process.env.FUNCTION_SSL_KEY),
  cert: fs.readFileSync(process.env.FUNCTION_SSL_CERT)
};

https.createServer(options, (req, res) => {
  res.writeHead(200);
  res.end('hello world\n');
}).listen(8000);

Reported issues

grant commented 4 years ago

WDYT @juliehockett?

grant commented 3 years ago

There are workarounds, like proxying your container with a SSL cert handler. Given that and the number of requests for this feature, closing.