Logfile shows wrong IP when behind reverse proxy #12244

Closed
opened 2025-11-02 10:03:09 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @Pakbon on GitHub (Dec 20, 2023).

Description

I have set up the webinterface behind an Nginx reverse proxy, as shown here: https://docs.gitea.com/administration/reverse-proxies
I have also set up logging in the app.ini.

When an outside IP address tries to reach the webinterface, the log file only shows the IP address of the reverse proxy and not the IP of the requestor
The expectation is that X-Real-IP would be shown in the logfile.

Gitea Version

1.21.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://paste.linux.chat/?fe0c4b3c336378da#5XPXyEP5oRimBjyGiw2w9VM56KUEUoHpXohLnMpCbMt4

Screenshots

No response

Git Version

git version 2.34.1

Operating System

Ubuntu 22.04.3 LTS

How are you running Gitea?

Gitea downloaded from official site
Running via systemd
Distro is Ubuntu 22.04.3

Database

MySQL/MariaDB

Originally created by @Pakbon on GitHub (Dec 20, 2023). ### Description I have set up the webinterface behind an Nginx reverse proxy, as shown here: https://docs.gitea.com/administration/reverse-proxies I have also set up logging in the app.ini. When an outside IP address tries to reach the webinterface, the log file only shows the IP address of the reverse proxy and not the IP of the requestor The expectation is that X-Real-IP would be shown in the logfile. ### Gitea Version 1.21.2 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist https://paste.linux.chat/?fe0c4b3c336378da#5XPXyEP5oRimBjyGiw2w9VM56KUEUoHpXohLnMpCbMt4 ### Screenshots _No response_ ### Git Version git version 2.34.1 ### Operating System Ubuntu 22.04.3 LTS ### How are you running Gitea? Gitea downloaded from official site Running via systemd Distro is Ubuntu 22.04.3 ### Database MySQL/MariaDB
GiteaMirror added the issue/needs-feedback label 2025-11-02 10:03:10 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Dec 20, 2023):

Have you set REVERSE_PROXY_TRUSTED_PROXIES ? See the document.

@wxiaoguang commented on GitHub (Dec 20, 2023): Have you set `REVERSE_PROXY_TRUSTED_PROXIES` ? See the document.
Author
Owner

@Pakbon commented on GitHub (Dec 20, 2023):

@wxiaoguang No, that was not set. Setting it now shows the correct IP in the logfile, thanks!

@Pakbon commented on GitHub (Dec 20, 2023): @wxiaoguang No, that was not set. Setting it now shows the correct IP in the logfile, thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12244