Add dav proxy directions to example proxy configurations

Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
kolaente 2020-08-20 14:08:35 +02:00
parent ebd71d1f04
commit d88551e99d
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 14 additions and 8 deletions

View file

@ -88,7 +88,7 @@ server {
proxy_pass http://frontend:80; proxy_pass http://frontend:80;
} }
location /api/ { location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://api:3456; proxy_pass http://api:3456;
client_max_body_size 20M; client_max_body_size 20M;
} }

View file

@ -74,7 +74,7 @@ services:
restart: unless-stopped restart: unless-stopped
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.vikunja-api.rule=Host(`vikunja.example.com`) && PathPrefix(`/api/v1`)" - "traefik.http.routers.vikunja-api.rule=Host(`vikunja.example.com`) && PathPrefix(`/api/v1`, `/dav/`, `/.well-known/`)"
- "traefik.http.routers.vikunja-api.entrypoints=https" - "traefik.http.routers.vikunja-api.entrypoints=https"
- "traefik.http.routers.vikunja-api.tls.certResolver=acme" - "traefik.http.routers.vikunja-api.tls.certResolver=acme"
frontend: frontend:
@ -133,7 +133,7 @@ services:
labels: labels:
- "traefik.docker.network=web" - "traefik.docker.network=web"
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.frontend.rule=Host:vikunja.example.com;PathPrefix:/api/v1" - "traefik.frontend.rule=Host:vikunja.example.com;PathPrefix:/api/v1,/dav/,/.well-known"
- "traefik.port=3456" - "traefik.port=3456"
- "traefik.protocol=http" - "traefik.protocol=http"
frontend: frontend:
@ -179,7 +179,7 @@ server {
proxy_pass http://frontend:80; proxy_pass http://frontend:80;
} }
location /api/ { location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://api:3456; proxy_pass http://api:3456;
client_max_body_size 20M; client_max_body_size 20M;
} }
@ -240,6 +240,8 @@ You will need the following `Caddyfile` on your host (or elsewhere, but then you
{{< highlight conf >}} {{< highlight conf >}}
vikunja.example.com { vikunja.example.com {
reverse_proxy /api/* api:3456 reverse_proxy /api/* api:3456
reverse_proxy /.well-known/* api:3456
reverse_proxy /dav/* api:3456
reverse_proxy frontend:80 reverse_proxy frontend:80
} }
{{< /highlight >}} {{< /highlight >}}

View file

@ -43,7 +43,7 @@ server {
index index.html index.htm; index index.html index.htm;
} }
location /api/ { location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://localhost:3456; proxy_pass http://localhost:3456;
client_max_body_size 20M; client_max_body_size 20M;
} }
@ -67,7 +67,7 @@ server {
index index.html index.htm; index index.html index.htm;
} }
location /api/ { location ~* ^/(api|dav|\.well-known)/ {
proxy_pass http://localhost:3456; proxy_pass http://localhost:3456;
client_max_body_size 20M; client_max_body_size 20M;
} }
@ -92,14 +92,18 @@ Put the following config in `cat /etc/apache2/sites-available/vikunja.conf`:
</Proxy> </Proxy>
ProxyPass /api http://localhost:3456/api ProxyPass /api http://localhost:3456/api
ProxyPassReverse /api http://localhost:3456/api ProxyPassReverse /api http://localhost:3456/api
ProxyPass /dav http://localhost:3456/dav
ProxyPassReverse /dav http://localhost:3456/dav
ProxyPass /.well-known http://localhost:3456/.well-known
ProxyPassReverse /.well-known http://localhost:3456/.well-known
DocumentRoot /var/www/html DocumentRoot /var/www/html
RewriteEngine On RewriteEngine On
RewriteRule ^\/?(config\.json|favicon\.ico|css|fonts|images|img|js|api) - [L] RewriteRule ^\/?(config\.json|favicon\.ico|css|fonts|images|img|js|api|dav|\.well-known) - [L]
RewriteRule ^(.*)$ /index.html [QSA,L] RewriteRule ^(.*)$ /index.html [QSA,L]
</VirtualHost> </VirtualHost>
{{< /highlight >}} {{< /highlight >}}
**Note:** The apache modules `proxy` and `proxy_http` must be enabled for this. **Note:** The apache modules `proxy`, `proxy_http` and `rewrite` must be enabled for this.
For more details see the [frontend apache configuration]({{< ref "install-frontend.md#apache">}}). For more details see the [frontend apache configuration]({{< ref "install-frontend.md#apache">}}).