Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for TLS & HTTP/2 #69

Merged
merged 6 commits into from
Sep 14, 2021
Merged

Adds support for TLS & HTTP/2 #69

merged 6 commits into from
Sep 14, 2021

Conversation

joshuawright11
Copy link
Member

@joshuawright11 joshuawright11 commented Sep 14, 2021

By default, the server runs over HTTP/1.1.

Enable TLS

To enable running HTTP/1.1 over TLS, use useHTTPS.

func boot() throws {
    try useHTTPS(key: "/path/to/private-key.pem", cert: "/path/to/cert.pem")
}

Enable HTTP/2

To enable HTTP/2 upgrades (will prefer HTTP/2 but still accept HTTP/1.1 over TLS), use useHTTP2.

func boot() throws {
    try useHTTP2(key: "/path/to/private-key.pem", cert: "/path/to/cert.pem")
}

Note that the HTTP/2 protocol is only supported over TLS, so implies using it. Thus, there's no need to call both useHTTPS and useHTTP2; useHTTP2 sets up both TLS and HTTP/2 support.

@joshuawright11 joshuawright11 merged commit ba39656 into main Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant