title: Traefik "Request has been aborted" and "TLS handshake error" error showing up in logs
body: <p>I am experiencing periodic request failures when accessing my webapp using Traefik.</p>
  
  <p>I am using:</p>
  
  <ul>
  <li>Dockerized Flask app served with Gunicorn</li>
  <li>official postgres docker container</li>
  <li>official Traefik docker container</li>
  <li>docker-compose to start all the above containers</li>
  </ul>
  
  <p>Everything runs on a single AWS EC2 instance. I am mainly using Traefik to get the automatically generated SSL cert from letsencrypt</p>
  
  <p>For the most part everything works as I would hope. However periodically when loading my page in the browser it hangs. When I check the network tab I can see some of the requested documents have failed to load.</p>
  
  <p>I turned on access logs and set the log level to DEBUG in Traefik and reloaded my page until I was able to see the error. The first time I was able to capture the error the logs did not indicate anything was wrong. They showed Traefik responding with the document with a 200 response. Here is the relevant log portion and a screen shot of the safari network pane</p>
  
  <p>log: <a href="https://pastebin.com/DUegF4UU" rel="nofollow noreferrer">https://pastebin.com/DUegF4UU</a></p>
  
  <p><a href="https://i.stack.imgur.com/qkiUY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qkiUY.png" alt="enter image description here"></a></p>
  
  <p>After capturing more successes and failures I was ultimately able to see an error that might be relevant in the logs:</p>
  
  <pre><code>traefik    | time="2019-01-09T22:14:54Z" level=debug msg="Request has been aborted [96.92.159.193:63283 - /admin/static/vendor/jquery.min.js?v=2.1.4]: net/http: abort Handler"
  traefik    | time="2019-01-09T22:15:08Z" level=debug msg="http: TLS handshake error from 96.92.159.193:37272: EOF"
  </code></pre>
  
  <p>Here is the full collection of relevant log lines: <a href="https://pastebin.com/9uXxFDEs" rel="nofollow noreferrer">https://pastebin.com/9uXxFDEs</a></p>
  
  <p>And the network pane:</p>
  
  <p><a href="https://i.stack.imgur.com/wE8k6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wE8k6.png" alt="enter image description here"></a></p>
  
  <p>Some things to note:</p>
  
  <p>1) This does not happen with every request</p>
  
  <p>2) Even when it does happen, I do not necessarily see an error</p>
  
  <p>3) Out of 10 failures I capured with DEBUG logging the "Request has been aborted" error showed up twice and the "TLS handshake error" showed up once</p>
  
  <p>Just for completeness, here is the log and network pane for a successful request:</p>
  
  <p>log: <a href="https://pastebin.com/f1WhUWYk" rel="nofollow noreferrer">https://pastebin.com/f1WhUWYk</a></p>
  
  <p><a href="https://i.stack.imgur.com/x5n3o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x5n3o.png" alt="enter image description here"></a></p>
  
  <p>Here is my traefik.toml file:</p>
  
  <pre><code>debug = false
  logLevel = "DEBUG"
  defaultEntryPoints = ["http", "https"]
  
  [web]
  # Port for the status page
  address = ":8080"
  [web.auth.basic]
  users = ["admin:nope"]
  
  # Entrypoints, http and https
  [entryPoints]
  # http should be redirected to https
  [entryPoints.http]
  address = ":80"
      [entryPoints.http.redirect]
      entryPoint = "https"
  # https is the default
  [entryPoints.https]
  address = ":443"
      [entryPoints.https.tls]
  
  # Enable ACME (Let's Encrypt): automatic SSL
  [acme]
  # Email address used for registration
  email = "mine"
  storageFile = "/etc/traefik/acme.json"
  entryPoint = "https"
  onDemand = false
  OnHostRule = true
  [acme.httpChallenge]
  entryPoint = "http"
  
  [retry]
  
  # Enable Docker configuration backend
  [docker]
  endpoint = "unix:///var/run/docker.sock"
  watch = true
  exposedbydefault = false
  </code></pre>
  
  <p>Please let me know if any more information might be helpful.</p>
  
  <p>EDIT: After more experimentation it seems I only get the response failures when Traefik is running in a docker container. When I run it straight on the host machine (with my app still running in docker) then I no longer see any issues.</p>