GitLab fails to update Jira issue

Gitlab fails to update jira issue with error Gitlab::HTTP::RedirectionTooDeep

Environment

GitLab: 13.0.6
GitLab Installation: Docker Container
Jira Version: 8.8

GitLab is installed behind an apache reverse proxy.

Issue Description

I’ve configured GitLab to Integrate with Jira so that commit messages that reference Jira issues can be used to add links and comments to them.

Every time that I do a commit I get the following error and the Jira Issue state remains unchanged.

    {
    "severity": "WARN",
    "time": "2020-06-18T10:47:04.388Z",
    "error_class": "Gitlab::HTTP::RedirectionTooDeep",
    "error_message": "Gitlab::HTTP::RedirectionTooDeep",
    "context": "Job raised exception",
    "jobstr": "{\"class\":\"ProcessCommitWorker\",\"args\":[534,158,{\"id\":\"a03215695b7e3faedc78ff292cf293a1dee644b4\",\"message\":\"TRAP-5490 testing jira integration\",\"parent_ids\":[\"ea4d143679268ee3b0541dffb93c6975ca0296ea\"],\"authored_date\":\"2020-06-18 10:44:02 +0000\",\"author_name\":\"Pedro Rainho Chaves\",\"author_email\":\"<anonymized>\",\"committed_date\":\"2020-06-18 10:44:02 +0000\",\"committer_name\":\"Pedro Rainho Chaves\",\"committer_email\":\"<anonymized>\"},true],\"retry\":3,\"queue\":\"process_commit\",\"jid\":\"9cb0aef3f4ea8b2a4b569745\",\"created_at\":1592477043.2843068,\"meta.user\":\"<anonymized>\",\"meta.project\":\"<anonymized>/test\",\"meta.root_namespace\":\"<anonymized>\",\"meta.caller_id\":\"PostReceive\",\"correlation_id\":\"75861b4edf12851a67cec42b505988c7\",\"enqueued_at\":1592477223.9475527,\"error_message\":\"Gitlab::HTTP::RedirectionTooDeep\",\"error_class\":\"Gitlab::HTTP::RedirectionTooDeep\",\"failed_at\":1592477045.858769,\"retry_count\":2,\"retried_at\":1592477161.2248492}",
    "class": "ProcessCommitWorker",
    "args": [
        "534",
        "158",
        "{\"id\"=>\"a03215695b7e3faedc78ff292cf293a1dee644b4\", \"message\"=>\"TRAP-5490 testing jira integration\", \"parent_ids\"=>[\"ea4d143679268ee3b0541dffb93c6975ca0296ea\"], \"authored_date\"=>\"2020-06-18 10:44:02 +0000\", \"author_name\"=>\"Pedro Rainho Chaves\", \"author_email\"=>\"<anonymized>\", \"committed_date\"=>\"2020-06-18 10:44:02 +0000\", \"committer_name\"=>\"Pedro Rainho Chaves\", \"committer_email\"=>\"<anonymized>\"}",
        "true"
    ],
    "retry": 3,
    "queue": "process_commit",
    "jid": "9cb0aef3f4ea8b2a4b569745",
    "created_at": "2020-06-18T10:44:03.284Z",
    "meta.user": "<anonymized>",
    "meta.project": "<anonymized>/test",
    "meta.root_namespace": "<anonymized>",
    "meta.caller_id": "PostReceive",
    "correlation_id": "75861b4edf12851a67cec42b505988c7",
    "enqueued_at": "2020-06-18T10:47:03.947Z",
    "failed_at": "2020-06-18T10:44:05.858Z",
    "retry_count": 2,
    "retried_at": "2020-06-18T10:46:01.224Z",
    "error_backtrace": [
        "lib/gitlab/http.rb:26:in `rescue in perform_request'",
        "lib/gitlab/http.rb:23:in `perform_request'",
        "lib/gitlab/jira/http_client.rb:44:in `public_send'",
        "lib/gitlab/jira/http_client.rb:44:in `make_request'",
        "lib/gitlab/jira/http_client.rb:13:in `request'",
        "app/models/project_services/jira_service.rb:347:in `block in find_remote_link'",
        "app/models/project_services/jira_service.rb:415:in `jira_request'",
        "app/models/project_services/jira_service.rb:347:in `find_remote_link'",
        "app/models/project_services/jira_service.rb:329:in `block in send_message'",
        "app/models/project_services/jira_service.rb:415:in `jira_request'",
        "app/models/project_services/jira_service.rb:328:in `send_message'",
        "app/models/project_services/jira_service.rb:280:in `add_comment'",
        "app/models/project_services/jira_service.rb:201:in `create_cross_reference_note'",
        "app/services/system_notes/issuables_service.rb:131:in `cross_reference'",
        "app/services/system_note_service.rb:206:in `cross_reference'",
        "app/models/concerns/mentionable.rb:188:in `block in create_cross_references!'",
        "app/models/concerns/mentionable.rb:187:in `each'",
        "app/models/concerns/mentionable.rb:187:in `create_cross_references!'",
        "app/workers/process_commit_worker.rb:46:in `process_commit_message'",
        "app/workers/process_commit_worker.rb:36:in `perform'",
        "lib/gitlab/with_request_store.rb:17:in `enabling_request_store'",
        "lib/gitlab/with_request_store.rb:10:in `with_request_store'",
        "lib/gitlab/sidekiq_daemon/monitor.rb:49:in `within_job'"
    ]
    }

Configuration

I’ve followed the official docs (https://docs.gitlab.com/ee/user/project/integrations/jira.html) and this is what my current configuration looks like:

Troubleshooting steps already taken

  1. I can query Jira issues, add comment and links with curl from the docker container (everything works with curl)
  2. I can see a GET request from GitLab to Jira but no other requests.
  3. I’ve tried with different Jira issues and GitLab Projects, always the same error.

– edit –
I’ve tried from the gitlab-rails console and I get the following results:

irb(main):089:0> service = JiraService.where(:project_id => 11).first
=> #<JiraService id: 41, type: "JiraService", title: nil, project_id: 11, created_at: "2020-06-18 08:07:40", updated_at: "2020-06-18 08:07:40", active: true, properties: nil, push_events: true, issues_events: true, merge_requests_events: true, tag_push_events: true, note_events: true, category: "issue_tracker", default: false, wiki_page_events: true, pipeline_events: true, confidential_issues_events: true, commit_events: true, job_events: true, confidential_note_events: true, deployment_events: false, description: nil, comment_on_event_enabled: true, template: false, instance: false, comment_detail: "standard", inherit_from_id: nil>

irb(main):091:0> jira_issue = service.client.Issue.find('TRAP-5551')
(omitted issue details)

irb(main):076:0> links = jira_issue.remotelink.all 
Traceback (most recent call last):
        5: from (irb):76
        4: from lib/gitlab/jira/http_client.rb:13:in `request'
        3: from lib/gitlab/jira/http_client.rb:44:in `make_request'
        2: from lib/gitlab/jira/http_client.rb:44:in `public_send'
        1: from lib/gitlab/http.rb:24:in `perform_request'
Net::OpenTimeout (execution expired)

Any Ideas on what the problem might be?