I’ve been trying to solve this strange issue in the past two days, but with no luck. Maybe someone else solved it already, or can point me in the right direction
I installed Vikunja on a Debian 10 server with Postgres DB. By following the install instructions and using Nginx Proxy it worked immediately at first try, with no problems at all.
Then I decided to try the Apache server, and here I started having some issues.
On the first try I was always getting a blank page. After checking the errors in the browser console, I found that the server was not serving the content of the assets folders, nor the manifest.webmanifest file, so I added them to the rewrite rule in the apache vikunja.conf in order to have that content served directly from the frontend:
RewriteRule ^\/?(config\.json|favicon\.ico|assets|css|fonts|images|img|js|api|dav|\.well-known|manifest.webmanifest) - [L]
After reloading apache2 I could get the login page and everything looked fine: I could see al my tasks and work on them without any error in the console. Problem solved? Not completely, because every time I load the main or the login page I get this error in the browser console (domain redacted):
Vikunja frontend version 0.17.0+189-364d42b2b9
Error during service worker registration: DOMException: Failed to register a ServiceWorker for scope ('https://vikunja.domain.tld/') with script ('https://vikunja.domain.tld/sw.js'): The script has an unsupported MIME type ('text/html').
error @ index.365af209.js:18
s @ index.365af209.js:18
ab @ index.365af209.js:18
(anonymous) @ index.365af209.js:18
Promise.catch (async)
sb @ index.365af209.js:18
(anonymous) @ index.365af209.js:18
Promise.then (async)
ready @ index.365af209.js:18
(anonymous) @ index.365af209.js:18
I tried to find a solution on Google but I couldn’t find any. I’ve never used service workers so I do not understand what’s happening: it looks like the browser cannot register the Service Worker, but why? The same config works fine with Nginx. Maybe some RequestHeader missing in the Apache conf?