-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serviceworker.js failed to register (on windows) #18347
Comments
This is a common problem with cached out of date service workers. Forcibly reload the page and/or clear the serviceworker out. |
Did all that the straight away after installing 1.15.10, gave it a few days still no joy, then tried the RC and still no luck. Using fiddler, gitea is returning the serviceworker.js with content type text/plain
|
Hmm .... My Linux reports:
So the Content-Length/Etag is the same, I believe they are the same file. But the Content-Type is different. And since you are accessing
However, I can not reproduce your problem. |
However, I can not reproduce your problem: I downloaded the The response of
Everything seems fine. Do you have more clues? |
Is it only this one JS file that returns wrong mime type or the others as well? |
No clues as to what might cause the change to content type for the serviceworker.js file, version 1.15.10 returns the correct content type. serviceworker.js is the only file that has the wrong content type. |
Is your Windows registry correct? Does it contains correct |
We should probably not rely on registry in |
Ok, done some digging in the windows registry. [edit] all our computers/servers are standard installs with no customisation done other than installing IIS etc |
Do you have conclusions? Is your clue related to this issue? Golang's mime detector seems to work like this: there are some built-in mime-types (including |
Given the registry entries and how you describe the golang mime handling works, the text/plain is expected, i assume on the servers because there is no entry, there is a internal fallback that is used. I guess this means gitea is working as expected given the environment and this is a golang mime issue regarding the handling of windows and its broken defaults. This can be closed if you like, it doesn't appear to be a fault of gitea. |
Although it explains the issue, but I think how Golang handle mime types is not ideal (especially for Gitea HTTP server). I would like to propose a PR to make Gitea treat all well-known extensions as hard-coded mime-types to bypass the OS config. Please leave this issue open. |
I proposed a fix: |
Gitea Version
1.16.0-rc1
Git Version
git version 2.34.1.windows.1
Operating System
Windows 10 21H1 (build 19043.1466)
How are you running Gitea?
Downloaded gitea-1.16.0-rc1-gogit-windows-4.0-amd64.exe from the github releases page.
stopped windows service
Copied over top to replace existing gitea.exe
restarted windows service
Database
MSSQL
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Description
In edge & chrome, the serviceworker.js fails to install with an error logged to the console.
DOMException: Failed to register a ServiceWorker for scope ('http://localhost:3000/assets/') with script ('http://localhost:3000/assets/serviceworker.js'): The script has an unsupported MIME type ('text/plain').
First appeared when i installed version 1.15.10
Screenshots
No response
The text was updated successfully, but these errors were encountered: