Proxying to a subpath

Hey there, I'd like to provide a nextcloud calendar without login in my local wifi. So I got a a link from nextcloud like http://nextcloud/app/files/r/alksdjasdz

No I'd like to be able to rach this calendar by simply opening http://cal/ in my local network.

I tried it with PathReplace and AddPrefix and also by entering the full URL as service-url, but nothing worked.

Anybody knows how to make traefik proxy to a subpath? I don't want a redirect which is visible in the users browser.


Nobody a clue? Maybe any tips where to look at our where to ask better?


I assume that "ping cal" pings the IP address of the node where traefik is running.

In that case the instructions of following link might serve your needs:


When you say "Nothing worked"

Do you mean that Traefik did not properly proxy the request, or do you mean that your application did not accept the proxied request, and return the expected response?

Hey, thanks for your answers!

@janvda: yes ping results to the IP of traefik, but the way described in your link is eactly the same I tried:

        prefix: "/apps/calendar/p/A1B2C3"
        - url:
      service: cal-http
        - addprefix
      rule: Host(`cal`)
        - http

that leads to nextcloud redirecting (302) to http://cal/login. When I call nextcloud with the full URL directly there is no redirect. That also works from within the traefik container.

The traefik logs like this for the full/normal request:

externalIP - - [05/Feb/2020:20:59:21 +0100] "GET /apps/calendar/p/A1B2C3 HTTP/1.1" 200 3518 "-" "-" 50402 "nextcloud@docker" "" 104ms

For the http://cal request it looks like this:

externalIP - - [05/Feb/2020:20:59:49 +0100] "GET / HTTP/1.1" 302 0 "-" "-" 50411 "cal-lokal-http@file" "" 78ms
externalIP - - [05/Feb/2020:20:59:49 +0100] "GET /login HTTP/1.1" 200 3444 "-" "-" 50412 "cal-lokal-http@file" "" 75 ms 

So from what I understand nextcloud doesn't really recognize the added prefix and therefore just redirects to login like it normally does when called at the root domain..

What did I do wrong?! Did I get the concept wrong?

@daniel.tomcej: I don't really understand why, but I don't get any nextcloud log entries when calling those URLs.

From what I understand, it could be, because nextcloud relies on certain apps to be called from specific paths only, so it relies on calendars only be called from /apps/calendars. Any chance to fake that path to nextcloud?

So the client calls http://cal/ but nextcloud thinks the path is http://cal/apps/calendar?

1 Like

For troubleshooting, have you enabled your traefik dashboard and checked in the dashboard if the above rules are correctly registered ?

Yes, it's stated absolutely right there. The thing is that Nextcloud needs the subpath to be part of the URL and therefore my idea doesn't seem to work :frowning:

I puzzled a bit with AgenDAV again and got it running, so I am fine now. Thanks a lot for your help!