-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Problem
The GitLab plugin doesn't work when Backstage runs behind a reverse proxy with a subpath (e.g., /my-app/dev). The pathRewrite patterns can't match because the subpath is stripped before reaching the plugin.
Environment:
- Backstage:
1.44.2 - Backend URL:
https://domain.com/my-app/dev
What Happens
Request sent: /my-app/dev/api/gitlab/rest/gitlab.com/api/v4/projects/123
Plugin receives: /rest/gitlab.com/api/v4/projects/123
Result: The subpath is lost, causing pathRewrite to fail → GitLab returns 404
Root Cause
Backstage's httpRouter mounts plugins at /api/{pluginId}, removing the upstream subpath before plugin middleware runs.
Workaround
Create a custom httpRouter service factory that restores the full path (with subpath) into req.originalUrl.
Proposed Solutions
- Auto-detect base path from
backend.baseUrlconfig - Add config option:
gitlab: basePath: /my-app/dev
- Use relative paths in
pathRewrite(no subpath needed)
Impact
Affects all Backstage deployments using reverse proxies (Nginx, Istio, etc.) with URL subpaths.
Metadata
Metadata
Assignees
Labels
No labels