Tomcat as backend

1. Caddy version (caddy version):

v2.3

2. How I run Caddy:

systemctl start caddy

a. System environment:

Debian 10

b. Command:

caddy reload

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

tomcat.domain.com {
   rewrite / /app-backend
   reverse_proxy 192.168.0.70:8080 {
   }
}

3. The problem I’m having:

i unable to browse domain https://tomcat.domain.com, cause the backend url including “/app-backend”.
The full backend URL is http://192.168.0.70:8080/app-backend/

That’s why i have to use rewrite for now, but it shows “/app-backend”. I want to browse https://tomcat.domain.com/ only.

How could i make it works?

Thank you.

You need to use * as your matcher, not /. Path matching in Caddy v2 is exact, so / means to only match exactly / and nothing else. Try this:

tomcat.domain.com {
   rewrite * /app-backend{uri}
   reverse_proxy 192.168.0.70:8080
}

If that doesn’t work, then your backend triggers redirects or serves responses with /app-backend in links and asset paths, then this approach won’t work, and you’ll need to make changes in your backend to accept requests at a different base path, without /app-backend.

Thanks @francislavoie for quick reply.

I tried as your recommend but it doesn’t work, it shows me “too many redirects”.
I guess this could be the case you mentioned, i don’t know how to make it to use without /app-backend

Axelor is backend app i am using.

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