Question about reverse proxy setup (Traefik)

I’ve been using Traefik reverse proxy for all my services, including Seafile, for many years. My old Traefik setup for Seafile looked like this:

http:


  routers:

    to-oak-seafile-dav:
      entryPoints:
        - web-secure
      rule: "Host(`oak.domain.net`) && PathPrefix(`/seafdav`)"
      service: oak-seafile-dav
      tls:
        certResolver: le
        domains:
          - main: "*.domain.net"

    to-oak-seafile-file:
      entryPoints:
        - web-secure
      rule: "Host(`oak.domain.net`) && PathPrefix(`/seafhttp`)"
      middlewares:
        - strip
      service: oak-seafile-file
      tls:
        certResolver: le
        domains:
          - main: "*.domain.net"

    to-oak-seafile:
      entryPoints:
        - web-secure
      rule: "Host(`oak.domain.net`)"
      service: oak-seafile
      tls:
        certResolver: le
        domains:
          - main: "*.domain.net"


  services:

    oak-seafile-dav:
      loadBalancer:
        servers:
          - url: http://192.168.1.243:8080/seafdav

    oak-seafile-file:
      loadBalancer:
        servers:
          - url: http://192.168.1.243:8082

    oak-seafile:
      loadBalancer:
        servers:
          - url: http://192.168.1.243:8000


  middlewares:

    strip:
      stripPrefix:
        prefixes:
          - "/seafhttp"


It works well for a binary installation of Seafile, CE 9 and 10.

Later I migrated it to a Docker setup on Unraid, and upgrade it to Pro Edition, and somehow my Traefik settings were greatly simplified like so:

http:

  routers:
    to-oak-seafile:
      entryPoints:
        - web-secure
      rule: "Host(`oak.domain.net`)"
      service: oak-seafile
      tls:
        certResolver: le
        domains:
          - main: "*.domain.net"

  services:
    oak-seafile:
      loadBalancer:
        servers:
          - url: http://192.168.1.100:8089

And it works well.

My question is, why one need stripprefix, the other doesn’t? Is it because of binary / docker difference, or version 9, 10, 11 difference?

I ask because yesterday I tried upgrade to 12, and there was some problem with reverse proxy. According to this GitHub issue comment, it seems “stripprefix” is needed after all. Then how come I don’t need it for PE 11 Docker setup?

With the non-docker setups you had to divide by /seafdav, /seafhttp, and everything else, and forward each to a different port so it went to the right program. In the docker version (at least for docker ersion of 12, I never looked at older docker versions), there is an nginx running inside the container that does that spiting for you, and it has a rewrite rule that I think is doing the same thing as your “stripPrefix”.

I decided to bypass the nginx inside the docker, so I still have the rewrite that I think is the same as stripPrefix. You could simplify down to just forward everything for oak.domain.net to the docker port 80, and let the nginx inside sort it out.

I never looked at the docker containers for older versions but I suspect it is the same.

1 Like