Reverse proxy to Xen-Orchestra Docker container not working as expected

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

I use the official Docker image (caddy:latest)

a. System environment:

Docker

b. Command:

Again, standard Docker image. I have not customized it.

c. Service/unit/compose file:

version: "3.9"

services:
  caddy:
    image: caddy
    container_name: caddy
    hostname: caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /home/richard/docker/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
      - /home/richard/docker/caddy/site:/srv:ro
      - /home/richard/docker/caddy/data:/data:rw
      - /home/richard/docker/caddy/config:/config:rw
      - /home/richard/.acme.sh/server.powellhouse.net_ecc:/cert:ro

d. My complete Caddy config:

  server.powellhouse.net {

    tls /cert/server.powellhouse.net.cer /cert/server.powellhouse.net.key {
      protocols tls1.2
  }

  reverse_proxy /xen-orchestra* xen-orchestra:80

  root * /srv
  file_server
}

3. The problem I’m having:

When I browse to https://server.powellhouse.net/xen-orchestra I am being redirected to https://server.powellhouse.net/signin. It seems to me I should be redirected to https://server.powellhouse.net/xen-orchestra/signin but that’s unfortunately not what’s happening.

4. Error messages and/or full log output:

N/A - not getting an error message. Just not getting expected behavior. See below.

Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

5. What I already tried:

I have tried to use handle_path like this:

handle_path /xen-orchestra* {
    reverse_proxy xen-orchestra:80
  }

But got the same behavior. I also tried rewrite:

handle_path /xen-orchestra* {
    rewrite * /xen-orchestra{uri}
    reverse_proxy xen-orchestra:80
  }

Again, same behavior.

6. Links to relevant resources:

Xen-Orchestra does give examples of how to do the reverse-proxying using Apache or nginx: Configuration | XO documentation (xen-orchestra.com)

See this article:

Your upstream app needs to be aware of the subpath you want to use, because your upstream app is responsible for constructing the URLs in the Location header for redirects, and in the HTML responses.

1 Like

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