I need help translate caddyfile to v2

1. Caddy version (caddy version):

v2.1

2. How I run Caddy:

caddy run

a. System environment:

mac OS Catalina

b. Command:


c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

localhost {
  root dist
  proxy /xxx/v1.0 https://xxx.xxx.xxx
  rewrite {
    if {path} not_starts_with /emoneyKyc/v1.0
    to {path} /
  }
  gzip
  tls self_signed
}

3. The problem I’m having:

I need v2 type for this caddyfile I have.

4. Error messages and/or full log output:

5. What I already tried:

:2015 {
  try_files {path} /index.html
  root dist
  file_server
  reverse_proxy --from /xxx/v1.0 --to https://xxx.xxx.xxx 
  encode zstd gzip
}

but when i visit my url in local it shows error 500, 502 in the page.

reverse_proxy --from is a CLI command/option. You’re looking for the reverse_proxy directive

Also, in Caddy v2, path matching is exact-match, meaning you’ll need to add a * after /xxx/v1.0 for it to match anything other than exactly /xxx/v1.0.

The rest looks ok to me.

Thank you very much although my information is not that completed above.
I’ll test on this and report back asap.

due to the architect complexity, I guess my problem now is im not able to use caddy to consume my internal API-s it just got 401 from the API, but this is not Caddy problem already, so this post can be closed.

trully appreciate your effort in help checking my caddyfile.

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