Answers: <p>I put <code>rules</code> instead of <code>rule</code> since there was more than one condition. That was it. All working now.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-06-03T23:29:29.837Z
Answers: 2023-06-03T23:29:29.837Z
Answers: Gerald
Body: <p>In Traefik2, I've got <code>router.toml</code> that contains the following lines:</p>
  <pre><code>[http.routers]
      [http.routers.sonarr-bypass]
          rules = &quot;Host(`sonarr.DOMAIN.com`) &amp;&amp; Headers(`traefik-auth-bypass-key`, `thekey`)&quot;
          middleware = [&quot;chain-no-auth&quot;]
          service = &quot;sonarr&quot;
          [http.routers.sonarr-bypass.tls]
      [http.routers.sonarr]
          rule = &quot;Host(`sonarr.DOMAIN.com`)&quot;
          middlewares = [&quot;chain-oauth&quot;]
          service = &quot;sonarr&quot;
          [http.routers.sonarr.tls]
      
  [http.services]
      [http.services.sonarr.loadBalancer]
          [[http.services.sonarr.loadBalancer.servers]]
              url = &quot;http://192.168.50.51:8989&quot;
  </code></pre>
  <p>The <code>chain-no-auth</code> and <code>chain-oauth</code> middlewares work elsewhere, like in my <code>docker-compose.yml</code>, but the above sends me to my OAuth server regardless of my headers when accessing the URL <code>sonarr.DOMAIN.com</code>.</p>
  <p>Am I missing something? Perhaps I need to set the priority?</p>
  
Comments: CC BY-SA 4.0
Comments: 2023-06-03T23:28:54.243Z
Comments: Okay, I put `rules` instead of `rule` since there was more than one condition. That was it. Dumb me.
Comments: Gerald
Tags: <docker><authentication><traefik>
Title: Bypassing OAuth in Traefik router that routes to other network device
UserDisplayName: Gerald
ThreadText: # Bypassing OAuth in Traefik router that routes to other network device
  
  (Asked by: username_0 on 2023-06-03)
  
  In Traefik2, I've got `router.toml` that contains the following lines:
  
  ```
  [http.routers]
      [http.routers.sonarr-bypass]
          rules = "Host(`sonarr.DOMAIN.com`) && Headers(`traefik-auth-bypass-key`, `thekey`)"
          middleware = ["chain-no-auth"]
          service = "sonarr"
          [http.routers.sonarr-bypass.tls]
      [http.routers.sonarr]
          rule = "Host(`sonarr.DOMAIN.com`)"
          middlewares = ["chain-oauth"]
          service = "sonarr"
          [http.routers.sonarr.tls]
      
  [http.services]
      [http.services.sonarr.loadBalancer]
          [[http.services.sonarr.loadBalancer.servers]]
              url = "http://192.168.50.51:8989"
  
  ```
  
  The `chain-no-auth` and `chain-oauth` middlewares work elsewhere, like in my `docker-compose.yml`, but the above sends me to my OAuth server regardless of my headers when accessing the URL `sonarr.DOMAIN.com`.
  
  Am I missing something? Perhaps I need to set the priority?
  
  **Tags:** docker, authentication, traefik
  
  > **Comments:**
  > **username_0**: Okay, I put `rules` instead of `rule` since there was more than one condition. That was it. Dumb me.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-06-03. Score: 0
  
  I put `rules` instead of `rule` since there was more than one condition. That was it. All working now.
  
  
  ---
  
  