How can I use Caddy to proxy for another site?

1.8k Views Asked by At

I have a service on foo.bar.com and I need to move it to foo.example.com. To give stragglers a chance to catch up I was hoping to put Caddy on on the server dealing with foo.bar.com and have it proxy for foo.example.com. Can't get even a basic example working like:

Caddyfile

:2015
reverse_proxy https://example.com
1

There are 1 best solutions below

0
On

This is correct example, You did not provided any debugging and any information about the error you are getting.

Caddy by default expects https if web configuration is either not IP or you explicitly tell this is http endpoint.

So it should work for you with curl https://localhost:2016/

Enable debugging and show us any error.

To increase verbosity put this on your Caddyfile

:2015 {
    log {
        level DEBUG
        output stdout
    }
    reverse_proxy https://example.com