Traefik IP Whitelist in Dokploy

I wanted to experiment with applying an IP whitelist to an app deployed in Dokploy.

The documentation for ipAllowList contains an example for how to set up the middleware, but it needs to be added to the router middlewares (for both HTTP and HTTPS).

This is the modified traefik config (under the Advanced tab in your app).

http:
  middlewares:
    test-ipallowlist:
      ipAllowList:
        sourceRange:
          - "IP_ADDRESS_OR_RANGE"
          # ...
  routers:
    test-testapp-m7wwp0-router-1:
      rule: Host(`MY-HOST`)
      service: test-testapp-m7wwp0-service-1
      middlewares:
        # Add here...
        - test-ipallowlist
        - redirect-to-https
      entryPoints:
        - web
    test-testapp-m7wwp0-router-websecure-1:
      rule: Host(`MY-HOST`)
      service: test-testapp-m7wwp0-service-1
      middlewares:
        # ... and here.
        - test-ipallowlist
      entryPoints:
        - websecure
      tls:
        certResolver: letsencrypt
  services:
    test-testapp-m7wwp0-service-1:
      loadBalancer:
        servers:
          - url: http://test-testapp-m7wwp0:80
        passHostHeader: true