Use 2 middlewares of the same type in the same router

Hi,

I would like to use 2 middlewares of the same type in the same router but didn't succeed to make that kind of configuration working.

For example, in the dynamic config i have created 2 middlewares for IP Whitelisting

http:
  middlewares:
    Station1IpWhitelist:
      ipWhiteList:
        sourceRange:
        - 172.20.x.x/32
    Station2IpWhitelist:
      ipWhiteList:
        sourceRange:
        - 172.20.y.y/32

If in a router definition i use one of them, everything work normally. If i combine these 2 middlewares none of whitelist is working and i cannot access anymore the service.

Thanks

Best regards,

Alexandre

Did not you already post this question here? Middlewares : questions and suggestions

Yes i reposte in a dedicated topic because i have mixed different subjects in the first one.
Should i delete my first topic?

Thanks

Hello

In your case you can maybe write things like that :

http:
  middlewares:
    StationsIpWhitelist:
      ipWhiteList:
        sourceRange:
          - "172.20.x.x/32"
          - "172.20.y.y/32"
          - "z.z.z.z/32"
          - "......."

But i'm facing the same problem beacause one of my IP as a different depth and i can't write them in the same middleware :

http:
  middlewares:
    Station1IpWhitelist:
      ipWhiteList:
        sourceRange:
        - x.x.x.x/32
    Station2IpWhitelist:
      ipWhiteList:
        sourceRange:
        - y.y.y.y/32
        ipStrategy:
          depth: 2

When we add multiples middlewares to a router they are applied with a logical AND, i would love to apply them with the OR.
Something like a OR chain with theses 2 ranges, and then apply this chain to the router.

Guys, can we may be take the discussion here and let this thread die? There is no point discussing the same thing in two threads.