Skip to content

When Gitea is placed after the reverse proxy, the port number of the original request recorded in the access log is "0" #35682

@gesangtome

Description

@gesangtome

Description

When I use nginx to reverse proxy my gitea instance, the original request port recorded in the log is always 0. However, when I access it from a local network, it works normally.

I tried to set two HTTP headers, But it invalid:

proxy_set_header X-Real-IP $remote_addr:$remote_port;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;

Why?

6 14:55:00.057855+00:002025/10/16 14:55:00 HTTPRequest [I] router: completed GET / for 192.168.1.4:48260, 200 OK in 1.0ms @ web/home.go:32(web.Home)

2025-10-16 14:55:28.155992+00:002025/10/16 14:55:28 HTTPRequest [I] router: completed GET / for xx.xx.xx.xx:0, 200 OK in 0.9ms @ web/home.go:32(web.Home)

Gitea Version

v1.24.6

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

Built-in

Operating System

Truenas Docker

How are you running Gitea?

gitea containers prepared by truenas developers.

Database

MySQL/MariaDB

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions