Skip to content

Reverse proxy with Traefik on sub-path leads to a HTTP 302 redirection loop #23047

Closed
@gelven4sec

Description

@gelven4sec

Description

The title of the issue should be clear, I uploaded a screenshot below.

Here's my Gitea compose :

version: "3"

networks:
  proxy:
    external: true

services:
  gitea:
    image: gitea/gitea:1.18
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - ROOT_URL=https://<MY DOMAIN>/git/
      - OFFLINE_MODE=true
      - DISABLE_SSH=true
      - RUN_MODE=dev
    restart: always
    networks:
      - proxy
    volumes:
      - ./data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 3000:3000
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.gitea.tls=true"
      - "traefik.http.routers.gitea.rule=Host(`<MY DOMAIN>`) && PathPrefix(`/git/`)"
      - "traefik.http.services.gitea.loadbalancer.server.port=3000"

I tried every combination of trailing slashes with ROOT_URL and PathPrefix, couldn't make it work.
If I remove ROOT_URL and access it from https://<MY DOMAIN>:3000 it works fine.

The logs should give you relevant informations.

If we get to find the solution, I would be happy to contribute to documentation about sub-path with traefik like other proxies.

Gitea Version

1.18.4 (Digest: fc835996f659)

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/sven-eliasen/7f9ee471b212417f82f66e9cb0527226

Screenshots

image

Git Version

No response

Operating System

RHEL

How are you running Gitea?

Running with docker, see description for compose.

Database

SQLite

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