Skip to content

Bug: Mention avatars ignore ROOT_URL after upgrade to 1.24.7 #35798

@valentin2105

Description

@valentin2105

Description

🐛 Bug: Mention avatars ignore ROOT_URL after upgrade to 1.24.7

Version:
Upgraded from 1.19.x1.24.7

Setup:

  • Gitea is hosted behind a reverse proxy

  • Public URL: https://domain.tld/gitea

  • Configured ROOT_URL in app.ini:

    [server]
    ROOT_URL = https://domain.tld/gitea/

Expected behavior:
When mentioning a user in an issue, PR, or comment (@username), the user’s avatar URL should respect the ROOT_URL, just like on normal pages.

Actual behavior:
After upgrading to 1.24.7, avatars for mentions are being loaded from the internal hostname instead of the configured ROOT_URL.

Example:

✅ Correct URL (on normal pages):

https://domain.tld/gitea/avatars/8ef5c96979134bd04f6c933a9fdf2461

❌ Incorrect URL (when mentioning a user):

https://vm-hostname.domain.tld:3000/gitea/avatars/8ef5c96979134bd04f6c933a9fdf2461

Project's avatar are impacted too.

We tried to add REVERSE_PROXY_TRUSTED_PROXIES = * and PUBLIC_URL_DETECTION = legacy but don't change anything.

Impact:
This breaks avatar loading for mentioned users when Gitea runs behind a reverse proxy or on a subpath, since the internal hostname is not accessible externally.

Steps to reproduce:

  1. Run Gitea behind a reverse proxy on a subpath, e.g. https://domain.tld/gitea.
  2. Mention a user in an issue or comment.
  3. Observe the avatar request URL in the browser’s dev tools.

Notes:

  • The behavior worked correctly on version 1.19.x.
  • It seems that avatar URLs for mentions are now built using the internal hostname/port rather than the configured ROOT_URL.

Environment:

  • Gitea 1.24.7 (binary)
  • OS: Debian 12
  • Database: PostgreSQL

Gitea Version

1.24.7

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Debian 12

How are you running Gitea?

I use Gitea binairie with systemd

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detail

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions