Skip to content

url error when using nginx reverse proxy mode #17912

Closed
@jue-jue-zi

Description

@jue-jue-zi

Gitea Version

1.15.7

Git Version

2.25.1

Operating System

Ubuntu Ubuntu 20.04.3 LTS

How are you running Gitea?

Run the binary file downloaded from github releases with systemd and use nginx reverse proxy model for the gitea with the below configs:

  # gitea
  location /git/ {
      proxy_pass https://localhost:10080/;
      proxy_redirect off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header Early-Data $ssl_early_data;

      client_max_body_size        10g;
      client_body_buffer_size     128k;
  }

And gitea config app.ini is as below:

[server]
PROTOCOL = https
DOMAIN = xxx.com
HTTP_PORT = 10080
ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s/git/
CERT_FILE = /xxx/xxx.crt
KEY_FILE = /xxx/xxx.key
SSH_DOMAIN = %(DOMAIN)s
DISABLE_SSH = false
START_SSH_SERVER = true
SSH_PORT = 10022
SSH_LISTEN_HOST = 0.0.0.0
SSH_LISTEN_PORT = %(SSH_PORT)s
LFS_START_SERVER = true
LFS_CONTENT_PATH = /xxx/lfs
LFS_JWT_SECRET = xxx
OFFLINE_MODE = true

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

It works great when using the ROOT_URL to access the website. However, when we use another domain to access gitea, some problems appear (because we use different domains to access gitea in the LAN or the Internet). When accessing the issuse page with url https://xxx.com/git/issues, all the issuses shown in the list are linked to the ROOT_URL set in app.ini which leads to failed access. But the domains of other links in the page can automatically change to adapt to the current accessing host. I wonder if the links in the issue page can also automatically adapt to the current accessing host or if there's additional settings should be added to nginx to achieve this. Thanks.

Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/duplicateThe issue has already been reported.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions