How to use caddy as reverse proxy for local domain with https

Viewed 1046

Is it possible to use caddy for local development where you have https://mysite.loc and use Caddyfile as reverse proxy to your services running on localhost?

My hosts file so I have local mysite.loc domain

127.0.0.1   mysite.loc
mysite.loc {
  reverse_proxy /api localhost:5000
  reverse_proxy /admin localhost:6000
  reverse_proxy /graphql localhost:7000
  reverse_proxy localhost:4000

  tls ???
}

And thats about how far I got. I think I need to somehow point mysite.loc to running caddy daemon so it can intercept the request provide generated certs which I would then trust locally and also act as proxy redirecting to my locally running services. I also think I don't need to generate any certificates myself caddy should do it right? I would also like to avoid having to use any ports for mysite.loc like https://mysite.loc:4000 just https://mysite.loc and then let Caddy handle the rest. I would also like to avoid using docker.

0 Answers
Related