Replies: 4 comments 7 replies
|
You are right, certificate selection happens during the TLS handshake, before HFS receives an HTTP request. |
|
Provided that you already have your secondary certificate (or many), it seems possible for a plugin to add the support for it. That said, HFS already has a lower-level plugin path for this. A backend plugin can access the HTTPS server through Example shape: exports.init = function(api) {
const fs = api.require('fs')
const tls = api.require('tls')
api.onServer(server => {
server.addContext('minecraft.example.com', tls.createSecureContext({
cert: fs.readFileSync('/path/to/cert.pem'),
key: fs.readFileSync('/path/to/key.pem'),
}))
})
} |
|
ok i published the plugin but i cannot test it. |
|
very well! 🎉 |

Uh oh!
There was an error while loading. Please reload this page.
I've been using HFS as the public entry point for several self-hosted services, and I've been really impressed with how capable the reverse-proxy plugin is.
While working on this setup, I ran into one area where plugins, as far as I can tell, currently cannot help: TLS certificate selection.
If I understand correctly, because the TLS handshake happens before the HTTP request is routed, the reverse-proxy plugin does not currently get an opportunity to present a hostname-specific certificate.
Is there currently any mechanism for plugins to participate in certificate selection via SNI, or would this require changes within HFS itself?
If there is not currently a way to do this, would exposing that capability to plugins be something you would consider?
That would allow the reverse-proxy plugin, or another plugin, to handle TLS certificates for specific hostnames where a different certificate is needed.
A simple example is a Minecraft subdomain. The Minecraft service itself needs the hostname to remain DNS-only / grey-clouded in Cloudflare, because Cloudflare's normal free proxy does not support Minecraft TCP traffic. However, because that hostname still points to the same public IP, browser requests to that subdomain can still hit HFS on ports 80/443.
In that case, HFS presents the default Cloudflare Origin Certificate, which is fine for Cloudflare-proxied hostnames, but invalid for direct browser access. This results in a browser certificate warning before HFS or the reverse-proxy plugin can route or reject the request.
Being able to select certificates by hostname through SNI, or expose SNI certificate selection to plugins, would allow HFS to remain the public entry point while still handling mixed certificate scenarios cleanly.
All reactions