Fix OAuth for relative path
What does this MR do and why?
This change fixes URL generation in OAuth-related endpoints to properly handle GitLab installations that are hosted in subdirectories (like example.com/gitlab instead of just example.com).
Previously, the code was using the incoming request's URL to build response URLs, which could be inconsistent. Now it uses GitLab's configured base URL and a utility function to properly combine URL paths. This ensures that when GitLab is installed in a subdirectory, all OAuth endpoints return URLs that include the correct subdirectory path.
The changes affect two controllers that provide OAuth metadata, and include comprehensive tests to verify that URLs are correctly formatted when GitLab runs in a subdirectory configuration. This makes OAuth authentication work reliably regardless of how GitLab is deployed.
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.