-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Error 404 on /serviceworker.js when serving static resources from reverse proxy #11989
Comments
A Serviceworker must per spec be from first-party origin to work, that's why we have to load it from the main origin instead of https://w3c.github.io/ServiceWorker/#origin-restriction Essentially:
I guess we can only update the docs. |
Great, thank you! That's what I initially suspected :) |
Thought I don't quite understand your issue. If you have |
I did not look at the code yet but I think it might be happening that if |
Further info: request for |
Correction; not exactly "succeeds", gitea is returning 302 status (rather than 404 for authenticated users). I am yet to find where that 302 redirection leads to. EDIT: from Chrome developer tools I extracted this (for un-authenticated user):
NB, this request actually gets stalled. Same from router log:
For authenticated user the following happens:
Same from router log:
|
I can't quite replicate, I see 200s on
Any other changed settings in your config that might be relevant? |
The 302 is a separate issue which is fixed in #11872 but I see I need to pull out that fix separately there. Still can't explain your 404, what exact gitea version is it and how did you build it? |
From
From nginx:
NB I redacted actual site with |
It is gitea 1.12.0 , built with https://github.com/Bronek/build-gitea |
Fixes a wrong 302 redirect to the login page, see go-gitea#11989. Also made it so the reserved username list is extended with those known entries so we avoid code duplication. Should be backported to 1.12.
Opened #11992 to fix the 302 issue. |
That fixed it - thank you! |
Fixes a wrong 302 redirect to the login page, see #11989. Also made it so the reserved username list is extended with those known entries so we avoid code duplication. Should be backported to 1.12.
Fixes a wrong 302 redirect to the login page, see go-gitea#11989. Also made it so the reserved username list is extended with those known entries so we avoid code duplication. Should be backported to 1.12.
I am not sure if that needs a fix, or is just an artifact of local cache behaviour but I've seen it on 3 different browsers so reporting here: After succesfull login, the content of Access log from gitea:
Chrome developer tools reporting:
EDIT: this appears to have been fixed after I cherry-picked #11992 / #11994 |
Fixes a wrong 302 redirect to the login page, see go-gitea#11989. Also made it so the reserved username list is extended with those known entries so we avoid code duplication. Should be backported to 1.12.
[x]
):Description
As a result of #11577 , the reverse proxy configuration recommended in https://docs.gitea.io/en-us/reverse-proxies/#using-nginx-as-a-reverse-proxy-and-serve-static-resources-directly is no longer correct. This is because Gitea is not using
STATIC_URL_PREFIX
forserviceworker.js
file and the request is instead issued for/serviceworker.js
. With the recommended configuration that request will be in turn proxied over to Gitea and then fail, resulting in 404 error.The fix which worked for me was to add this stanza to my Nginx configuration:
I assume this is either:
STATIC_URL_PREFIX
should have been used forserviceworker.js
file, but isn't.BTW thank you for this awesome project!
...
Screenshots
The text was updated successfully, but these errors were encountered: