title: How to view failed proxying in Traefik?
body: <p>I'm building a PHP web app based on micro-services, and currently, the routes into my app are on different ports. This is fine for development, but isn't going to be so reliable once I have launched. I have:</p>
  
  <ul>
  <li>SPA frontend on port 10001</li>
  <li>HTTP API on port 10000</li>
  <li>Web Socket on 10002</li>
  </ul>
  
  <p>I would like these all to be on the same port. I recently found <a href="https://traefik.io/" rel="nofollow noreferrer">Traefik</a> which looks very flexible and would be able to accommodate my future needs. I appreciate I can do <a href="https://stackoverflow.com/a/44452656">simple proxying with NginX</a> but I quite like the idea of being able to tell the proxy to redirect traffic via an API (will be useful in the future).</p>
  
  <p>However, I have set up a Traefik configuration and it does not seem to be proxying as I intend. I am struggling to get it to produce logs to say what it is wrong, and I am looking for a "quick win" to encourage me to persist with it further.</p>
  
  <p>I have configured it with a host-to-container volume so it can explore Docker, using <code>-v /var/run/docker.sock:/var/run/docker.sock</code>). I don't really understand why it needs to know about my containers, since I was intending to set up all the configuration in my <code>traefik.toml</code>.</p>
  
  <p>So, as I (dimly) understand it, I need to set up entrypoints (where traffic comes in), frontends (decisions on how to route it) and backends (servers that do stuff). My initial attempt looks like this:</p>
  
  <pre><code># Entrypoints definition
  #
  # It looks like we have one entry point, and use
  # frontends to filter WS/HTTP
  
  [entryPoints]
    [entryPoints.everything]
    address = ":10005"
  
  # Frontends definition
  
  [frontends]
    [frontends.http]
      backend = "backend-spa"
    [frontends.http-api]
      backend = "backend-http-api"
      rule = "PathPrefix: /v1/captcha"
    [frontends.ws]
      backend = "backend-ws"
  
  # Backends definition
  
  [backends]
    [backends.backend-spa]
      url = "http://missive-interface:80"
    [backends.backend-http-api]
      url = "http://missive-controller:8080"
    [backends.backend-ws]
      url = "http://missive-controller:8081"
  </code></pre>
  
  <p>Presently I have just one container per service. I am differentiating the HTTP API on a pattern matcher, and I guess I would match the socket server on something as well (perhaps the <code>Upgrade</code> header).</p>
  
  <p>So, when I visit <code>http://localhost:10005/</code> I get <code>404 page not found</code>. Well, fair enough, I've probably misconfigured something. So I reset the loglevel to <code>INFO</code> and I get this:</p>
  
  <pre><code>time="2017-09-06T13:45:35Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml" 
  time="2017-09-06T13:45:35Z" level=info msg="Traefik version v1.4.0-rc1 built on 2017-08-29_08:35:24AM" 
  time="2017-09-06T13:45:35Z" level=info msg="Preparing server everything &amp;{Network: Address::10005 TLS:&lt;nil&gt; Redirect:&lt;nil&gt; Auth:&lt;nil&gt; WhitelistSourceRange:[] Compress:false ProxyProtocol:false} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s" 
  time="2017-09-06T13:45:35Z" level=info msg="Starting provider *docker.Provider {"Watch":true,"Filename":"","Constraints":null,"Trace":false,"DebugLogGeneratedTemplate":false,"Endpoint":"unix:///var/run/docker.sock","Domain":"","TLS":null,"ExposedByDefault":true,"UseBindPortIP":false,"SwarmMode":false}" 
  time="2017-09-06T13:45:35Z" level=info msg="Starting provider *web.Provider {"Address":":8080","CertFile":"","KeyFile":"","ReadOnly":false,"Statistics":null,"Metrics":null,"Path":"","Auth":null,"Debug":false,"CurrentConfigurations":{},"Stats":{"Uptime":"2017-09-06T13:45:35.383750945Z","Pid":1,"ResponseCounts":{},"TotalResponseCounts":{},"TotalResponseTime":"0001-01-01T00:00:00Z"},"StatsRecorder":null}" 
  time="2017-09-06T13:45:35Z" level=info msg="Starting server on :10005" 
  time="2017-09-06T13:45:35Z" level=error msg="No entrypoint defined for frontend frontend-Host-missive-controller-app, defaultEntryPoints:[]" 
  time="2017-09-06T13:45:35Z" level=error msg="Skipping frontend frontend-Host-missive-controller-app..." 
  time="2017-09-06T13:45:35Z" level=error msg="No entrypoint defined for frontend frontend-Host-missive-interface-app, defaultEntryPoints:[]" 
  time="2017-09-06T13:45:35Z" level=error msg="Skipping frontend frontend-Host-missive-interface-app..." 
  time="2017-09-06T13:45:35Z" level=error msg="No entrypoint defined for frontend frontend-Host-missive-storage-app, defaultEntryPoints:[]" 
  time="2017-09-06T13:45:35Z" level=error msg="Skipping frontend frontend-Host-missive-storage-app..." 
  time="2017-09-06T13:45:35Z" level=error msg="No entrypoint defined for frontend frontend-Host-missive-transmitter-app, defaultEntryPoints:[]" 
  time="2017-09-06T13:45:35Z" level=error msg="Skipping frontend frontend-Host-missive-transmitter-app..." 
  time="2017-09-06T13:45:35Z" level=info msg="Server configuration reloaded on :10005" 
  </code></pre>
  
  <p>However, when triggering the 404, no extra logs are output on <code>stdout</code>, so I cannot tell what the issue is. I don't think it is one of my services that is producing this.</p>
  
  <p>I am guessing that maybe my backends should indicate the name of the container that handles that service, so I can remove the "Skipping" errors? I should note also that I am not using Kubernetes or anything like that - it's just plain Docker Compose for now.</p>
  
  <p>What thing am I not spotting that would move me forward?</p>
  
  <h2>Update</h2>
  
  <p>Traefik seems to be very unhappy if I don't give it access to my Docker config. If I remove the <code>-v</code> volume switch on <code>docker run</code> then I get this added to logs, every second or so:</p>
  
  <pre><code>time="2017-09-06T17:18:20Z" level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?" 
  time="2017-09-06T17:18:20Z" level=error msg="Provider connection error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?, retrying in 443.292653ms" 
  </code></pre>
  
  <p>I have also found how to turn on <code>[accessLogs]</code> in config, and I get this written to <code>stdout</code>. These show my requests are hitting the proxy, but they don't give any information as to how they are being routed, nor whether my frontend and backend definitions are recognised as valid.</p>
  
  <pre><code>172.17.0.1 - - [06/Sep/2017:17:57:44 +0000] "GET / HTTP/1.1" %!d(&lt;nil&gt;) %!d(&lt;nil&gt;) - "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0" 1 - - 0ms
  172.17.0.1 - - [06/Sep/2017:17:57:49 +0000] "GET /index.php HTTP/1.1" %!d(&lt;nil&gt;) %!d(&lt;nil&gt;) - "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0" 2 - - 0ms
  172.17.0.1 - - [06/Sep/2017:17:58:09 +0000] "GET /index.php HTTP/1.1" %!d(&lt;nil&gt;) %!d(&lt;nil&gt;) - "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0" 3 - - 0ms
  </code></pre>