Skip to content

Commit

Permalink
fix: tls options (#1529)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk authored Aug 5, 2022
1 parent af735da commit c76939d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/events/http/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,19 @@ export default class HttpServer {
},
}

// HTTPS support
// https support
if (typeof httpsProtocol === 'string' && httpsProtocol.length > 0) {
const [cert, key] = await Promise.all([
readFile(resolve(httpsProtocol, 'cert.pem'), 'utf-8'),
readFile(resolve(httpsProtocol, 'key.pem'), 'utf-8'),
])

serverOptions.tls = {
cert: readFile(resolve(httpsProtocol, 'cert.pem'), 'ascii'),
key: readFile(resolve(httpsProtocol, 'key.pem'), 'ascii'),
cert,
key,
}

console.log(cert)
}

// Hapijs server creation
Expand All @@ -103,7 +110,9 @@ export default class HttpServer {
? request.response.output
: request.response

const explicitlySetHeaders = { ...response.headers }
const explicitlySetHeaders = {
...response.headers,
}

if (
this.#serverless.service.provider.httpApi &&
Expand Down

0 comments on commit c76939d

Please sign in to comment.