Gitea behind apache proxy with HTTPS returns 404 for sign-in/register #4302

Closed
opened 2025-11-02 05:45:17 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @vedranMv on GitHub (Nov 13, 2019).

Description

Hi,
I couldn't find anything similar reported and I think this is not a bug per se, but more related to my setup.
I have a self-hosted domain with dynamic DNS. On my ubuntu server, I have apache running natively with HTTPS (Let's encrypt). The domain is at https://hsr.duckdns.org
What I'm trying to do is make apache host local files whenever you hit the link, but when you hit https://hsr.duckdns.org/gitea it should route the traffic to Gitea running in docker, localhost:3000 and over http only. It works for the most part. As you can see, gitea is accessible through the link above.

Problem is that whenever I try to access anything that's not home page (e.g. register/login), gitea returns 404 - page not found. In apache log, I can see apache returns status 404 when requesting /gitea/serviceworker.js and /gitea/user/sign_up. It looks like it's requesting the correct link (/gitea/*) but nothing is there.

Apache log: https://gist.github.com/vedranMv/e653be659000735026c65afdf8824487
app.ini: https://gist.github.com/vedranMv/8ded743f1130b30f7e03148bdb5844f3

I hope someone can help with a debugging tip or an idea what I might be doing wrong :)

Edit: Seems to be similar to: https://github.com/go-gitea/gitea/issues/5505

Screenshots

image

Originally created by @vedranMv on GitHub (Nov 13, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.11.0+dev-123-gbc1775b49 (docker) - Git version: 2.22.0 - Operating system: Ubuntu 18.04.3 LTS - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: https://gist.github.com/vedranMv/84b37a2d093b2fe10651858c57404c74 ## Description Hi, I couldn't find anything similar reported and I think this is not a bug per se, but more related to my setup. I have a self-hosted domain with dynamic DNS. On my ubuntu server, I have apache running natively with HTTPS (Let's encrypt). The domain is at https://hsr.duckdns.org What I'm trying to do is make apache host local files whenever you hit the link, but when you hit https://hsr.duckdns.org/gitea it should route the traffic to Gitea running in docker, localhost:3000 and over http only. It works for the most part. As you can see, gitea is accessible through the link above. Problem is that whenever I try to access anything that's not home page (e.g. register/login), gitea returns 404 - page not found. In apache log, I can see apache returns status 404 when requesting _/gitea/serviceworker.js_ and _/gitea/user/sign_up_. It looks like it's requesting the correct link (_/gitea/*_) but nothing is there. Apache log: https://gist.github.com/vedranMv/e653be659000735026c65afdf8824487 app.ini: https://gist.github.com/vedranMv/8ded743f1130b30f7e03148bdb5844f3 I hope someone can help with a debugging tip or an idea what I might be doing wrong :) Edit: Seems to be similar to: https://github.com/go-gitea/gitea/issues/5505 ## Screenshots ![image](https://user-images.githubusercontent.com/20846919/68759396-dec5c300-060f-11ea-9c3f-8306cae82d4b.png) <!-- **If this issue involves the Web Interface, please include a screenshot** -->
Author
Owner

@zeripath commented on GitHub (Nov 13, 2019):

ENABLE_REVERSE_PROXY_AUTHENTICATION = true
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = true
ENABLE_REVERSE_PROXY_EMAIL        = true

Are you actually providing this functionality?

@zeripath commented on GitHub (Nov 13, 2019): ``` ENABLE_REVERSE_PROXY_AUTHENTICATION = true ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = true ENABLE_REVERSE_PROXY_EMAIL = true ``` Are you actually providing this functionality?
Author
Owner

@vedranMv commented on GitHub (Nov 13, 2019):

Honestly, I am not sure what these do.
But the behavior is the same regardless of their value.

@vedranMv commented on GitHub (Nov 13, 2019): Honestly, I am not sure what these do. But the behavior is the same regardless of their value.
Author
Owner

@zeripath commented on GitHub (Nov 13, 2019):

Remove them.

We also need to see the router logs from Gitea. It would be helpful to look at your Apache proxy config too

@zeripath commented on GitHub (Nov 13, 2019): Remove them. We also need to see the router logs from Gitea. It would be helpful to look at your Apache proxy config too
Author
Owner

@vedranMv commented on GitHub (Nov 13, 2019):

Thank you for you help, it's solved now!
Looking at the router log, I saw this:

2019/11/13 13:49:43 ...ers/routes/routes.go:106:func1() [D] Completed GET //user/sign_up 404 Not Found in 8.076243ms
2019/11/13 13:49:43 ...ers/routes/routes.go:100:func1() [D] Started GET //vendor/assets/octicons/octicons.min.css for x.x.x.x
2019/11/13 13:49:43 ...ers/routes/routes.go:106:func1() [D] Completed GET //vendor/assets/octicons/octicons.min.css 304 Not Modified in 375.205µs
2019/11/13 13:49:43 ...ers/routes/routes.go:100:func1() [D] Started GET //vendor/plugins/semantic/semantic.min.css for x.x.x.x
2019/11/13 13:49:43 ...ers/routes/routes.go:106:func1() [D] Completed GET //vendor/plugins/semantic/semantic.min.css 304 Not Modified in 572.795µs
2019/11/13 13:49:43 ...ers/routes/routes.go:100:func1() [D] Started GET //vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1 for x.x.x.x
2019/11/13 13:49:43 ...ers/routes/routes.go:106:func1() [D] Completed GET //vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1 304 Not Modified in 580.337µs
2019/11/13 13:49:43 ...ers/routes/routes.go:100:func1() [D] Started GET //vendor/plugins/promise-polyfill/polyfill.min.js for x.x.x.x

Where // in URL pointed me towards my apache configuration where I had:

ProxyPass /gitea http://127.0.0.1:3000/ nocanon
ProxyPassReverse /gitea http://127.0.0.1:3000/

After removing the slash shown after port number, everything works normally. Thank you once again for pointing me in the right direction :)

@vedranMv commented on GitHub (Nov 13, 2019): Thank you for you help, it's solved now! Looking at the router log, I saw this: ``` 2019/11/13 13:49:43 ...ers/routes/routes.go:106:func1() [D] Completed GET //user/sign_up 404 Not Found in 8.076243ms 2019/11/13 13:49:43 ...ers/routes/routes.go:100:func1() [D] Started GET //vendor/assets/octicons/octicons.min.css for x.x.x.x 2019/11/13 13:49:43 ...ers/routes/routes.go:106:func1() [D] Completed GET //vendor/assets/octicons/octicons.min.css 304 Not Modified in 375.205µs 2019/11/13 13:49:43 ...ers/routes/routes.go:100:func1() [D] Started GET //vendor/plugins/semantic/semantic.min.css for x.x.x.x 2019/11/13 13:49:43 ...ers/routes/routes.go:106:func1() [D] Completed GET //vendor/plugins/semantic/semantic.min.css 304 Not Modified in 572.795µs 2019/11/13 13:49:43 ...ers/routes/routes.go:100:func1() [D] Started GET //vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1 for x.x.x.x 2019/11/13 13:49:43 ...ers/routes/routes.go:106:func1() [D] Completed GET //vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1 304 Not Modified in 580.337µs 2019/11/13 13:49:43 ...ers/routes/routes.go:100:func1() [D] Started GET //vendor/plugins/promise-polyfill/polyfill.min.js for x.x.x.x ``` Where **//** in URL pointed me towards my apache configuration where I had: ``` ProxyPass /gitea http://127.0.0.1:3000/ nocanon ProxyPassReverse /gitea http://127.0.0.1:3000/ ``` After removing the slash shown after port number, everything works normally. Thank you once again for pointing me in the right direction :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4302