Reverse proxy virtual directories to ports

1. The problem I’m having:

Firstly, I’m using Caddy with Docker. This seems to work fine although I’ve not been able to get any logging other than the basic “it’s started” and any errors I make in the Caddyfile.

I want to do this…

I have two working docker containers at…

http://www.mysite.org:8080
http://www.mysite.org:8081

I want to reverse proxy each of the above sites from

http://www.mysite.org/siteA
http://www.mysite.org/siteB

…respectively. Is this possible?

I haven’t a clue how to do this. I have tried various things, such as…

www.mysite.org:80 {
    reverse_proxy /siteA/* localhost:8081
}

…but it just results in a 404 error (albeit from apache which is running in the container)

Worse… I can’t figure out how to enable more comprehensive logging to see what Caddy is trying to do.

Please excuse total newbie stuff but I’m deeply confused :slight_smile:

2. Error messages and/or full log output:

n/a



## 3. Caddy version:
<!--
If you installed Caddy as a Linux package, run `caddy version`.
If you're running Caddy with Docker Compose, run `docker-compose exec caddy caddy version`.
DO NOT say "latest" or "v2", as this is not a specific version.
Please check that you're already running the latest version listed at https://github.com/caddyserver/caddy/releases, since your issue might have already been fixed in a previous release.
-->




## 4. How I installed and ran Caddy:
caddy:latest in docker

### a. System environment:
Ubuntu 22.04




### b. Command:
Docker


### c. Service/unit/compose file:

version: “3.9”

services:
caddy:
image: caddy:latest
restart: unless-stopped
ports:
- “80:80”
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./site:/srv
- caddy_data:/data
- caddy_config:/config
volumes:
caddy_data:
caddy_config:

~


### d. My complete Caddy config:
n/a


### 5. Links to relevant resources:
<!-- Optional, but can help get us on the same page quickly. -->

Please mind you post’s formatting, it’s kinda broken.

Take a look at this article:

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