[Backport 18.1] Reintroduce body for redirect responses

What does this MR do and why?

It's a backport for %18.1 to fix the redirect response as it was done for %18.2 - Reintroduce body for redirect responses (!195980 - merged).

Rails 7.1 removed body content from redirect responses: https://github.com/rails/rails/commit/c2e756a944fd3ca2efa58bd285c0e75e0b4794ab

However, some of the git clients rely on non-empty body, from Slack: https://gitlab.slack.com/archives/C093RMV088H/p1751030784906089

Background

The libgit2 library has a bug (https://github.com/libgit2/libgit2/issues/7070) that caused operations to hang when servers returned empty response bodies. This bug had been present for some time but went unnoticed because GitLab always included a You are being redirected message in redirect responses. There is a fix for libgit2 (https://github.com/libgit2/libgit2/pull/7024) but it’s not merged yet.

What Changed

GitLab 18.0 upgraded Rails from version 7.0.8.7 to 7.1.5.1 (!185625 (merged)). This newer Rails version changed redirect behavior (https://github.com/rails/rails/commit/c2e756a944fd3ca2efa58bd285c0e75e0b4794ab) to send empty response bodies instead.

Impact

This Rails change exposed the existing libgit2 bug, causing Git clients that use libgit2 to hang when receiving redirects from GitLab.

Solution

We need to reintroduce it and announce it as a breaking change

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The MR that fixed the bug on the default branch has been deployed to GitLab.com (not applicable for documentation or spec changes).
  • This MR has a severity label assigned (if applicable).
  • Set the milestone of the merge request to match the target backport branch version.
  • This MR has been approved by a maintainer (only one approval is required).
  • Ensure the e2e:test-on-omnibus-ee job has either succeeded or been approved by a Software Engineer in Test.

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

Edited by Igor Drozdov

Merge request reports

Loading