-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Gitea incorrectly applies STATIC_URL_PREFIX
when loading JS files
#18110
Comments
|
I think you misunderstood; the Gitea config is not at a subpath at all: server_name vc.ltdk.xyz;
location / {
proxy_pass http://unix:/run/gitea/gitea.sock;
proxy_redirect off;
proxy_set_header "Host" $host;
proxy_set_header "X-Forwarded-For" $proxy_add_x_forwarded_for;
} The static files for gitea are stored at a subpath, but that's just a subpath of a directory. Literally: server_name ht.ltdk.xyz;
root /srv/http/ht;
index index.htm index.html;
location / {
try_files $uri $uri/ =404;
} with the static files for gitea stored in For full clarification of the various ROOT_URL = https://vc.ltdk.xyz/
STATIC_URL_PREFIX = https://ht.ltdk.xyz/gitea/
STATIC_ROOT_PATH = ./ And as I mentioned, static files do work (CSS, images, etc.); it's just that this one JS file isn't being loaded correctly. I've also managed to get this working in the past, and I don't know if 1.15.7 specifically broke it or if it broke in a previous version and I didn't realise until now. |
I see your problem. The key problem might be here: gitea/web_src/js/features/tribute.js Line 65 in d2fac63
That And I would mention @silverwind to consult if my understanding is correct / if it's possible to get other solutions or refactoring. |
Thanks for helping out with this. I honestly have no idea how to debug weird webpack problems like this, so, hopefully someone can get to the bottom of this. If someone with a bit more knowledge on this is having trouble replicating it, I might have a ZFS snapshot back from the time when it did work and could do some bisection work, but at least for the moment I'd like to try and avoid that if someone does know how to fix this easily. |
Could you check on main/1.16 to see if this is still a problem there? |
I'm going to try updating to 1.15.9 first just to make sure it isn't fixed there either, but will keep updated on what happens. |
(Update on this, it still fails on 1.15.11, but I haven't updated to 1.16 yet to test. Will close if 1.16 changes fixed this.) |
I didn't see related PRs, so it's likely the issue is still the same (until someone submits a correct PR). |
So, I discovered my actual problem. I sort of assumed that I had earlier set things up and I guess just renamed the directory, so, when I re-extracted on update, it never actually used the up-to-date JS. This probably explains a lot of my problems. I'm going to close this issue but search later to figure out what can be done to make this more clear. |
Glad to hear that it's resolved. Since 1.17 , if there are JS errors, you will see a prompt on the web UI, so it will prevent some problems. |
I am experiencing the exact same problem on 1.17.3 (latest) see issue 21845 |
Gitea Version
1.15.7
Git Version
2.34.1
Operating System
Arch Linux
How are you running Gitea?
I'm using the Arch Linux package for gitea and reverse-proxying via nginx.
Database
PostgreSQL
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Description
I have gitea hosted at the URL https://vc.ltdk.xyz, and a
STATIC_URL_PREFIX
at https://ht.ltdk.xyz/gitea/.When loading
tribute.js
, it appears that gitea is somehow combining these two URLs into something that doesn't work, trying to load https://vc.ltdk.xyz/gitea/assets/js/tribute.js when the real URL is https://vc.ltdk.xyz/assets/js/tribute.js (note the lack ofgitea/
).I also have
STATIC_ROOT_PATH
set to./
if that matters at all -- I'm not exactly sure what this option is.If you'd like to view this problem live, the URL https://vc.ltdk.xyz/cli/viro/issues/4 seems to also have this problem when loading when not logged in. I tried going through the JS stack trace and just gave up since webpack doesn't really offer source maps for the actual file loading, and I have a feeling it's something messed up in there. If there's any particular thing I can do to make debugging easier, let me know and I can offer it.
Side note -- this completely prevents properly editing issues since there is no alternative to the JS-based editor, at least as far as I'm aware.
I also don't think upgrading to 1.15.8 would actually fix the problem since the changelog mentions nothing that could potentially change the behaviour, but if you do think that it would help, I can look into upgrading gitea manually and try that.
Screenshots
No response
The text was updated successfully, but these errors were encountered: