title: Register service worker failed with localhost
body: <p>I have the following error when I try to register a service worker in a basic app served by a node Express V4 server / on Chrome 42:</p>
  
  <blockquote>
    <p>DOMException: Failed to register a ServiceWorker: A bad HTTP response
    code (404) was received when fetching the script. {message: "Failed to
    register a ServiceWorker: A bad HTTP res…code (404) was received when
    fetching the script.", name: "NetworkError", code: 19, INDEX_SIZE_ERR:
    1, DOMSTRING_SIZE_ERR: 2…} code: 19 message: "Failed to</p>
  </blockquote>
  
  <p>Here is the register code :</p>
  
  <pre><code>    if ('serviceWorker' in navigator){
      console.log("SW present !!! ");
  
      navigator.serviceWorker.register('worker.js', {
        //scope: '/toto/'
      }).then(function(registration){
        console.log('Service worker registered : ', registration.scope);
      })
      .catch(function(err){
        console.log("Service worker registration failed : ", err);
      });
  
    }
  </code></pre>