feat(api): Add support for custom HTTP headers via config (which can point to environment variables)
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
Description
- Add
custom_headerssection to host config with support for direct header values and values loaded from environment variables - Apply headers to both GitLab client operations and direct API calls
- Add debug redaction for sensitive headers (Proxy-Authorization, Cf-Access-Client-Secret)
- Allows support for authentication proxies like Google IAP and Cloudflare Access
- Add test coverage for all header scenarios
- Update README with usage examples and authentication proxy patterns
Related Issues
Fixes #1037 (closed)
How has this been tested?
Unit tests, and manually by using it to perform operations on my IAP-protected self hosted Gitlab instance.
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap
Edited by Henri Cook