Add X-GitLab-Organization-ID header to axios and GraphQL calls

What does this MR do and why?

Related to #541693 (closed)

The grouporganizations team is working to build Organizations and part of this is having isolation so you only see the data (groups, projects, etc) that is in your organization. We need to pass the current organization as a header with any async frontend requests (axios or GraphQL). This MR adds a header to these requests in the global config.

For more info see https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/organization/current_organization/#header-field

Screenshots or screen recordings

Axios

Screenshot_2025-07-09_at_8.52.57_AM

GraphQL

Screenshot_2025-07-09_at_8.51.32_AM

How to set up and validate locally

  1. Go to /rails/features and enable ui_for_organizations feature flag
  2. Open dev tools Network tab
  3. Go to /-/organizations/default/groups_and_projects and view GraphQL request headers
  4. Go to /-/organizations/default/activity and view activity.json request headers

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.

Edited by Peter Hegman

Merge request reports

Loading