service worker registration not returning
<p>I have an apache server running. The backend as such is supported by django but placed on apache server. I have a service worker which otherwise works completely fine. Here's the code which does the registration</p>

<pre><code>navigator.serviceWorker.register('/static/js/components/sw.js').then(function() {
                            return navigator.serviceWorker.ready;
                        }).then(function(){console.log("success")})
</code></pre>

<p>But the above code somehow never gives any response. The promise remains in pending state.
Even adding a catch at the end doesn give any error. It goes to the navigator.serviceworker.ready but doesnt not resolve into the then function. I'm not sure what is the problem.</p>

<p>I've tried the following stuffs:</p>

<ul>
<li><p>I though the problem may be that service workers needs to be in same origin and all so i added  header called Service-Worker-Allowed:/static but that didnt do the job.</p></li>
<li><p>When i accessed the file by directly going to the path were html is saved (eg: mywebsite/static/serviceworker.html) after adding <strong>Service-Worker-Allowed: /static</strong>  It worked fine. But when i accessed the same html file by using the url mapped by django(i.e the url which i mapped through urls.py, eg: mywebsite/admin/worker ), it doesn seem to work.</p></li>
<li><p>Tried to give relative paths, but relative paths doesn work in my case.</p></li>
<li>I put this on another apache server and there it seems to work fine.</li>
</ul>

<p>I'm out of all ideas. Is this some django problem?</p>