Gitea web interface/HTML updates ROOT_URL Sub-Path for Reverse Proxy, but server doesn't and gives me 404 page not found. #8299

Closed
opened 2025-11-02 08:01:35 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @Stridsvagn69420 on GitHub (Dec 29, 2021).

Gitea Version

Gitea version 1.15.8 built with GNU Make 4.1, go1.16.12 : bindata, sqlite, sqlite_unlock_notify

Git Version

git version 2.20.1

Operating System

Raspberry Pi OS Buster armv7l 5.10.63-v7l+

How are you running Gitea?

I downloaded the gitea-1.15.8-linux-arm-6 binary, since this is the one that works on my Raspberry Pi 4, and installed everything according to the docs.
I'm normally running it via systemd (screenshots say I'm running it via command-line, but there's no difference between that for my issue) and Gitea worked yesterday when I first set it up.

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

After I failed using an unix socket instead of the loopback network for Nginx to work as a reverse proxy, Gitea started to just give me a 404 page not found when I tried to access it via the sub-path of Nginx. I already set everything back to normal and even ran gitea with a new config.
If I go to Gitea's webpage directly, I get the correct HTML, just the assets won't load since it tries to get them from the broken /<MySubPath>/....
But if I remove my sub-path from ROOT_URL it works just like it should (only directly though, not via Nginx' Reverse Proxy).

Here's my sub-path config:

location /Gitea/ {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Location-Name "Gitea";
                client_max_body_size 32M;
                proxy_pass http://localhost:2042;
}

Screenshots

With sub-path:
image
image

image
image

Without sub-path:
image
image

Originally created by @Stridsvagn69420 on GitHub (Dec 29, 2021). ### Gitea Version Gitea version 1.15.8 built with GNU Make 4.1, go1.16.12 : bindata, sqlite, sqlite_unlock_notify ### Git Version git version 2.20.1 ### Operating System Raspberry Pi OS Buster armv7l 5.10.63-v7l+ ### How are you running Gitea? I downloaded the [gitea-1.15.8-linux-arm-6](https://github.com/go-gitea/gitea/releases/download/v1.15.8/gitea-1.15.8-linux-arm-6) binary, since this is the one that works on my Raspberry Pi 4, and installed everything according to the docs. I'm normally running it via systemd (screenshots say I'm running it via command-line, but there's no difference between that for my issue) and Gitea worked yesterday when I first set it up. ### Database MySQL ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Description After I failed using an unix socket instead of the loopback network for Nginx to work as a reverse proxy, Gitea started to just give me a `404 page not found` when I tried to access it via the sub-path of Nginx. I already set everything back to normal and even ran gitea with a new config. If I go to Gitea's webpage directly, I get the correct HTML, just the assets won't load since it tries to get them from the broken `/<MySubPath>/....` But if I remove my sub-path from `ROOT_URL` it works just like it should (only directly though, not via Nginx' Reverse Proxy). Here's my sub-path config: ``` location /Gitea/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Location-Name "Gitea"; client_max_body_size 32M; proxy_pass http://localhost:2042; } ``` ### Screenshots With sub-path: ![image](https://user-images.githubusercontent.com/67603294/147693261-6bae15da-ed60-4cd5-8b6b-b4b5e450b84d.png) ![image](https://user-images.githubusercontent.com/67603294/147693293-2a3b67c4-1da5-42ef-a068-172078ed87fb.png) ![image](https://user-images.githubusercontent.com/67603294/147692326-0fc44fce-229e-4865-917a-091ef1276513.png) ![image](https://user-images.githubusercontent.com/67603294/147692095-f45899e9-75b5-4ea7-8bbf-ee61e0f11a9e.png) Without sub-path: ![image](https://user-images.githubusercontent.com/67603294/147692761-efc3eb6d-d1ae-48e8-9087-974ee0fb03ea.png) ![image](https://user-images.githubusercontent.com/67603294/147692937-5fdc7460-5604-4acd-bef6-ad6d84b3689b.png)
Author
Owner

@wxiaoguang commented on GitHub (Dec 30, 2021):

Please read the document. https://docs.gitea.io/en-us/reverse-proxies/#nginx-with-a-sub-path

image

@wxiaoguang commented on GitHub (Dec 30, 2021): Please read the document. https://docs.gitea.io/en-us/reverse-proxies/#nginx-with-a-sub-path ![image](https://user-images.githubusercontent.com/2114189/147716813-92762af9-851c-4744-ba74-36c88c056be3.png)
Author
Owner

@Stridsvagn69420 commented on GitHub (Dec 30, 2021):

Oh, my bad ^^'
I was missing the trailing slash

@Stridsvagn69420 commented on GitHub (Dec 30, 2021): Oh, my bad ^^' I was missing the trailing slash
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8299