Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Add TLS support #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mariovillaplana-okta
Copy link

This adds support for processing HTTPS requests on a separate port from
the usual HTTP requests. It does so by adding options for specifying the
path to a TLS key and a TLS certificate.

This can be useful for testing worker scripts that do things like custom
redirects depending on whether the user is making an encrypted request
or not.

Note: This PR does not yet set special request.cf attributes such as
tlsVersion and tlsCipher as described here:
https://developers.cloudflare.com/workers/reference/request-attributes/

@mariovillaplana-okta
Copy link
Author

I think we'd likely want to set the request.cf properties here:

function bindCfProperty (req) {
but I haven't had time to try that out yet

Copy link
Contributor

@hankjacobs hankjacobs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far. Just one minor fix. Also, please merge in master. Thanks!

if (httpsServer) {
httpsServer.close(() => { })
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks the return was dropped by this change. It's required so that a new server is created if stopping.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

This adds support for processing HTTPS requests on a separate port from
the usual HTTP requests. It does so by adding options for specifying the
path to a TLS key and a TLS certificate.

This can be useful for testing worker scripts that do things like custom
redirects depending on whether the user is making an encrypted request
or not.

Note: This PR does not yet set special `request.cf` attributes such as
`tlsVersion` and `tlsCipher` as described here:
https://developers.cloudflare.com/workers/reference/request-attributes/
@mariovillaplana-okta
Copy link
Author

mariovillaplana-okta commented May 20, 2019

@hankjacobs I added back the return and rebased against current master.

@fgilio
Copy link

fgilio commented Jul 8, 2019

Hi guys! Any plans on merging this PR?

@mjhaller
Copy link

I would be interested in the functionality in this PR. Any plans on merging it?

@heydonovan
Copy link

@hankjacobs Can we get this pulled in? We really need it. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants