1. Caddy version (caddy version
):
2.1.1
2. How I run Caddy:
a. System environment:
OS: Ubuntu Server 20.04
Caddy running in Docker (official image)
b. Command:
docker start caddy
c. Service/unit/compose file:
version: '2'
services:
db:
image: mariadb
container_name: nextcloud_db
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: unless-stopped
volumes:
- /home/docker/config/nextcloud/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=xxx
- MYSQL_PASSWORD=xxx
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud:19-apache
container_name: nextcloud_app
restart: unless-stopped
volumes:
- /home/docker/data/nextcloud/data:/var/www/html/data
- /home/docker/config/nextcloud/config:/var/www/html/config
- /home/docker/config/nextcloud/apps:/var/www/html/apps
onlyoffice-document-server:
image: onlyoffice/documentserver:latest
container_name: nextcloud_office
restart: unless-stopped
volumes:
- /home/docker/config/nextcloud/doc/data:/var/www/onlyoffice/Data
- /home/docker/config/nextcloud/doc/log:/var/log/onlyoffice
environment:
- JWT_ENABLED=true
- JWT_SECRET=xxx
d. My complete Caddyfile or JSON config:
Caddyfile:
cloud.myserver.com {
@office {
path_regexp test /ds-vpath/(.*)$
}
route /ds-vpath/* {
rewrite @office /{http.regexp.test.1}
reverse_proxy nextcloud_office:80
import headerssnippet
}
reverse_proxy nextcloud_app:80
import headerssnippet
}
nginx Config that works:
server {
listen 443 ssl;
server_name cloud.myserver.com;
client_max_body_size 1024M;
location / {
proxy_pass http://nextcloud_app;
}
location ~* ^/ds-vpath/ {
rewrite /ds-vpath/(.*) /$1 break;
proxy_pass http://nextcloud_office;
proxy_redirect off;
}
}
3. The problem I’m having:
I want to make my Onlyoffice Server reachable under /ds-vpath/ just like in my nginx config, so I can use it in my Nextcloud. But when the way I do it in Caddy I can’t get a connection to the server. The Nextcloud is working fine under Caddy. How can I configure Caddy to do the same thing as nginx when I connect to /ds-vpath/ ?
4. Error messages and/or full log output:
There are no Error messages, it just redirects me to the Nextcloud page instead of the welcome screen of the Onlyoffice server when I open /ds-vpath/.
5. What I already tried:
I have already tried this:
uri strip_prefix /ds-vpath/