Multiple Apps, WebAssembly, Endpoints not Ports?

I am brand new here so please pardon my questions in lieu of an informative post.

  1. Can I use Caddy as a single runtime that multiple apps rely on, or simply tie into separate apps on ports?
  2. Are there any compatibility issues between Caddy and WebAssembly I should know about?
  3. Can I link apps on ports to endpoints instead of other port numbers?

Apologies if the answers are obvious; I’m just starting out.

Howdy @allen-woods, welcome to the Caddy community.

Depends on the use case.

Theoretically you could develop your apps as Caddy apps in Go, complete with native JSON or Caddyfile configuration options, and they would run as Caddy itself does.

Alternately you could rely on Caddy’s http app and reverse proxy over ports or unix sockets to your upstream apps.

Not too familiar with WebAssembly myself, but I’m pretty sure this is all portable and client-side. Delivery is packaged with JavaScript, no? If the payload is transferred to the client via standard HTTP, Caddy should definitely have you covered.

You might have to forgive me in turn, I’m not entirely sure what you mean here.

Closest thing I can think of would be virtual hosts. Caddy can absolutely multiplex websites on the same port distinguished by hostname and abstract away the upstream servers’ ports so the client doesn’t see them, the client just sees the hostname.

If that’s not what you mean, let me know.

What I meant in question 3 was something like this:

App 1 on caddy port 9000 would map to**/app1endpoint**, not**:9000**
App 2 on caddy port 9001 would map to**/app2endpoint**, etc.
Can I do this in Caddy?

Or should I be using Nginx pointed at docker-compose instead of using Caddy?

Yeah, definitely. In nginx you’d probably call it location based proxying, right? Caddy can absolutely handle that for you.

You’d still run your apps at mysite:9000 and mysite:9001, but you’d firewall them off and have Caddy act as the gateway just like you would nginx: {
  redir /app1 /app1/
  handle_path /app1/* {
    reverse_proxy localhost:9000

  redir /app2 /app2/
  handle_path /app2/* {
    reverse_proxy localhost:9001

Or something along those lines.

Thank you @Whitestrake, also very glad to be here.

I’ll aim for a hello world of two simple processes and see how I get on from there.

This topic was automatically closed after 30 days. New replies are no longer allowed.