Https and TCP on the same port

Sorry for ditching the template, but I’m more looking for a hypothetical rather than an actual problem I’m facing. (Perhaps I’m even in the wrong forum category, I apologize.)

With Caddy, is it possible to run 2 separate services on port 443? For example, I want to run websites over https over port 443, but I also want to run a specific TCP service (that happens to not use any encryption) on that same port.

So, is it possible (natively or alternatively by writing an extension) to differentiate between https and [custom service] traffic, given I already have code to tell the 2 apart, and still make use the convenience of the Caddy configuration?

I hope the question makes sense.

Not with vanilla Caddy, but it is possible with Project Conncept (sponsor-only project for now):

1 Like

Oh, that looks very promising! Thanks for sharing that. I’m not sure I have $25 a month to spare right now even though I would love to support this project.

Is Conncept going to eventually ship with Caddy, or will it always remain an external app?

I will be looking into writing an extension myself in the meantime, is there anything in the documentation that you think would be a good place to start to “hook” into these connections?

1 Like

Great question – it’s a Caddy module, just like any other feature/functionality of Caddy. I doubt it will ship with our standard distribution/download unless most users need it (most just use it as an HTTP server, so that’s the primary functionality we ship by default) – but as you know from https://caddyserver.com/download, getting Caddy with extra plugins is as easy as a couple of clicks.

You could look into a listener wrapper:

But this would hook into the HTTP server only, I am not quite sure if it will fully do what you need, but it’s worth a shot; whereas Project Conncept doesn’t require an HTTP server, because it’s not an HTTP server.

Ultimately, Project Conncept is exactly what you want. It’s just not publicly available yet until we reach our sponsorship goal. If this is important to you, I would recommend advocating your company to apply a sponsorship. If we get more than lowest-tier sponsorships we can reach the goal sooner, so if your company is able to sponsor at a higher tier I could potentially release it tomorrow!

1 Like