Configuring Plugins
Once you have Portal Connect Agent deployed and running, you can configure your Backstage plugins to access internal services through the Agent. The key principle is simple: configure plugins as if they could access the services directly within the same network.How It Works
When you configure a Backstage plugin to access an internal service:- Use the internal hostname/URL directly in your plugin configuration (e.g.,
https://github.internal.company.com,https://artifactory.corp.net) - The Agent registers routes for these internal services with Portal
- When Portal makes a request to that URL, Portal Connect automatically tunnels the request through the Agent
- The Agent executes the request from within your network and returns the response
Configuration Approach
Internal Service URLs Configure your plugins with internal URLs exactly as you would if Portal were running inside your network: Example - GitHub Enterprise:Authentication and Credentials
For plugin configuration that requires authentication headers or API tokens: Option 1: Use dummy values in plugin configuration Since the Portal Connect Agent injects the real authentication headers (configured in the Agent’s routes), you can use placeholder values in your plugin configuration:Multi-Step Configuration Example
Step 1: Configure the Agent with the route and real credentials:Benefits of This Approach
- Simple plugin configuration - No special proxy settings or complex routing rules in Backstage
- Centralized credential management - All internal service credentials stay within your network at the Agent level
- Security - Credentials never leave your network perimeter
- Transparency - Plugins work as if Portal were running inside your network
- Maintainability - Plugin configurations remain clean and straightforward
Adding and Managing Routes
This section covers how to add, modify, and remove routes in Portal Connect Agent.Understanding Routes
Routes define which external URLs the Agent can access on behalf of your applications. Route Components A route consists of:- Protocol:
http://orhttps:// - Hostname: Domain name or IP address
- Path: Optional path component (exact or wildcard)
- Headers: Optional per-route default headers (advanced)
- Matches only:
https://api.github.com/users - Does not match:
https://api.github.com/users/octocat
- Matches:
https://api.github.com/users - Matches:
https://api.github.com/users/octocat - Matches:
https://api.github.com/repos/owner/repo - Does not match:
http://api.github.com/users(different protocol) - Does not match:
https://github.com/users(different hostname)
- Exact matches take precedence over wildcards
- More specific wildcards take precedence over less specific
- Routes are evaluated in the order configured
https://api.github.com/users/octocat matches the first route.
Adding Routes
Simple Routes To add routes without custom headers, use the array format:Route Planning
Before adding routes, consider: Scope: Use wildcards appropriately- Too broad:
https://*/*(avoid - too permissive) - Too narrow: Individual endpoints (maintenance overhead)
- Recommended: API version level
https://api.example.com/v1/*
- API keys
- Bearer tokens
- Custom authentication headers
- Apply principle of least privilege
- Only add routes that are necessary
Adding a New Route
Step 1: Update configuration Editapp-config.yaml:
Modifying Routes
Changing Route Patterns To change a route pattern (e.g., from exact to wildcard): Before:- Set the
GITHUB_TOKENenvironment variable - Restart the Agent
Route Security Best Practices
Principle of Least Privilege Only add routes that are absolutely necessary: ❌ Bad - too permissive:- Generate new credential
- Update environment variable or secret
- Restart Agent
- Revoke old credential
Common Route Patterns
GitHub APITroubleshooting Routes
Route Not Registered Symptom: Route doesn’t appear in logs or metrics Diagnostic:-
Check configuration syntax:
-
Validate YAML:
-
Check for configuration errors in logs:
- Fix YAML syntax errors
- Ensure routes are under
agent.routeskey - Restart Agent after configuration changes
- Verify exact URL being requested
- Check route pattern matches the URL
- Review logs for rejected requests
- Protocol mismatch: Route is
https://but request ishttp:// - Hostname mismatch: Different subdomain or domain
- Path mismatch: Wildcard doesn’t cover the requested path
- Adjust route pattern to match intended URLs
- Use wildcards appropriately
- Add specific routes for edge cases
-
Check environment variables are set:
- Verify header syntax in configuration
- Check logs for request details (debug level)
- Set missing environment variables
- Fix header syntax in configuration
- Ensure variable names match between config and environment
- Update credential in environment variable
- Verify credential is valid and not expired
- Check credential has necessary permissions for the API
Monitoring and Operations
Metrics Endpoint
The Agent exposes Prometheus metrics on port 9466 (configurable viaAGENT_METRICS_PORT).
Metrics PortThe metrics endpoint is optional and only needs to be accessible from your monitoring infrastructure within your network. It does not require inbound access from the internet - the Agent still only makes outbound connections for its primary function.
Key Metrics
Connection Metricsagent_websocket_connected
- Type: Gauge
- Description: WebSocket connection state (0 = disconnected, 1 = connected)
- Use: Monitor gateway connectivity
agent_websocket_reconnections_total
- Type: Counter
- Description: Total number of reconnection attempts
- Use: Track connection stability
agent_http_requests_total
- Type: Counter
- Labels: method, status_code, route
- Description: Total HTTP requests processed
- Use: Track request volume and status codes
agent_http_request_duration_seconds
- Type: Histogram
- Labels: method, route
- Description: HTTP request duration distribution
- Use: Monitor request latency
agent_http_request_errors_total
- Type: Counter
- Labels: method, route, error_type
- Description: Total HTTP request errors
- Use: Monitor error rates
agent_routes_registered
- Type: Gauge
- Description: Number of routes currently registered
- Use: Verify route configuration
Alerting
Recommended Alerts Critical Alerts WebSocket Disconnected:- Threshold: Alert if disconnected for > 5 minutes
- Action: Check network connectivity, Portal status, certificate validity
- Threshold: Alert 7 days before expiration
- Action: Generate and register new certificate
- Threshold: > 5% error rate over 5 minutes
- Action: Investigate logs, check external service status
- Threshold: Alert immediately
- Action: Restart Agent, check logs for crash reason
- Threshold: > 1% error rate over 15 minutes
- Action: Monitor, investigate if sustained
- Threshold: P95 latency > 5 seconds
- Action: Check external service performance
- Threshold: > 0.1 reconnections/second
- Action: Investigate network stability
Monitoring WebSocket Connection
The Agent automatically reconnects if the WebSocket connection drops:- Initial retry: 1 second
- Maximum retry interval: 60 seconds
- Uses exponential backoff with jitter
Monitoring Request Success
View request metrics:Health Checks
Docker Health CheckTroubleshooting
Connection Issues
WebSocket Connection Fails Symptoms:agent_websocket_connected{} == 0- Logs show
WebSocket connection failedorConnection refused
-
Verify WebSocket URL:
-
Test network connectivity:
-
Check firewall rules:
- Ensure outbound WSS (port 443 or 8080) allowed
- Test from Agent host
-
Verify certificates:
- Fix WebSocket URL in configuration
- Update firewall rules to allow outbound WSS
- Renew expired certificates
- Contact Spotify to verify Portal is operational
agent_websocket_reconnections_totalincreasing- Logs show repeated disconnect/reconnect cycles
-
Check connection stability:
-
Review network logs:
- Check for intermittent network issues
- Look for firewall or proxy interruptions
-
Verify Portal health:
- Contact Spotify support
- Check for Portal maintenance windows
- Resolve network stability issues
- Adjust firewall/proxy timeouts for WebSocket connections
- Coordinate with Spotify on Portal issues
- Repeated reconnection failures in logs
- Error message similar to:
Error: self-signed certificate in certificate chain agent_websocket_connected{} == 0even though broker URL and network access are correct- Other outbound HTTPS requests from the Agent may also fail
-
Check whether your organization performs SSL/TLS inspection
- Firewalls such as Palo Alto, Zscaler, Cisco, or Blue Coat may intercept and re-sign outbound TLS connections
- If so, Portal Connect’s WebSocket connection will be re-signed using a corporate CA that is not trusted by Node.js by default
-
Inspect Agent logs for certificate errors:
or:
-
Verify whether Node.js trusts your corporate CA
Inside the Agent container:
If your corporate CA is not listed, Node.js will reject the connection.
-
Ensure you have the correct TLS inspection certificates
- Export the root + intermediate CA certificates from your firewall
- Certificates must be PEM-encoded:
-
Create a CA bundle containing your corporate inspection certificates:
-
Mount the CA bundle into the Agent container
Example:
-
Tell Node.js to trust your corporate CA using
NODE_EXTRA_CA_CERTSDocker run:Docker Compose:Kubernetes: -
Restart or redeploy the Agent:
or:
-
Verify WebSocket connectivity:
Expected:
Request Failures
All Requests Failing Symptoms:- High error rate across all routes
- Logs show consistent request failures
-
Check Agent connectivity:
-
Verify routes are registered:
-
Test external service directly from Agent host:
- Restore WebSocket connection
- Fix route configuration and restart Agent
- Resolve network access to external services
- Errors for specific route/URL pattern
- Other routes working normally
-
Check route configuration:
-
Test service directly:
-
Check service-specific authentication:
- Verify headers configured correctly
- Test with actual credentials
- Fix route pattern (wildcard, exact match)
- Update authentication headers
- Verify external service is operational
- Logs show
Network timeoutorRequest timeout - Slow response times
-
Check request latency:
-
Test external service response time:
-
Review Agent resource usage:
- Increase timeout configuration (if configurable)
- Optimize external service performance
- Scale Agent resources if CPU/memory constrained
Certificate Issues
Certificate Validation Fails Symptoms:mTLS certificate validation failedin logs- Agent fails to start
-
Verify certificate files exist:
-
Check certificate validity:
-
Verify certificate and key match:
-
Check file permissions:
- Generate new certificates
- Fix file permissions (readable by container user)
- Ensure certificate is registered with Spotify
- Verify certificate and key are matching pair
Certificate expiredin logsagent_certificate_expiry_secondsnegative or very low
- Generate new certificate
- Register with Spotify
- Update certificate files
- Restart Agent
Configuration Issues
Configuration File Not Found Symptoms:Configuration file not foundorENOENTerror- Agent exits immediately
-
Check
CONFIG_PATH: -
Verify volume mount:
-
Check file exists in container:
- Fix
CONFIG_PATHenvironment variable - Fix volume mount path
- Verify file exists on host at mount source
Invalid configurationorYAML parse errors- Agent fails to start
-
Validate YAML syntax:
-
Check for common errors:
- Incorrect indentation
- Missing required fields
- Invalid route patterns
- Fix YAML syntax errors
- Validate against configuration reference
- Use YAML linter
- Headers contain literal
${VAR_NAME} - Authentication fails for external services
-
Check environment variables are set:
-
Review configuration:
- Set missing environment variables when starting container
- Fix environment variable name mismatch
- Use correct syntax:
${VAR_NAME}for env vars,${VAR_NAME_FILE}for file-based
Resource Issues
High CPU Usage Symptoms:- Container using > 80% CPU consistently
- Slow request processing
- Increase CPU limits
- Scale horizontally (add more Agent replicas)
- Investigate unusually high request volume
- Container approaching memory limit
OOMKilledevents (Kubernetes)
- Increase memory limits
- Check for memory leaks (contact Spotify support)
- Restart Agent to clear memory
docker psshows frequent restarts- Pod in
CrashLoopBackOff(Kubernetes)
-
Check logs:
-
Check exit code:
- Fix configuration errors causing startup failure
- Resolve certificate validation issues
- Check resource limits not too restrictive
- Review logs for specific error messages
Configuration Reference
This reference documents all configuration options for the Portal Connect Agent.Configuration File Format
The Portal Connect Agent uses YAML format for configuration. The default configuration file location isapp-config.yaml, but you can specify a custom path using the CONFIG_PATH environment variable.
Configuration Structure
Configuration Options
agent.brokerUrl
- Type: String (required)
- Description: WebSocket URL to connect the Agent to your Portal instance
- Format:
wss://broker.${subdomain}.spotifyportal.com
- Must use
wss://protocol (secure WebSocket) - Connection URL provided by Spotify
- Do not modify the path component
agent.routes
- Type: Array or Object (required)
- Description: Defines which external URLs the Agent can access
- Matches only:
https://api.example.com/v1/users
- Matches:
https://api.example.com/v1/usershttps://api.example.com/v1/users/123https://api.example.com/v1/anything
- Does not match:
https://api.example.com/v2/users(different path)http://api.example.com/v1/users(different protocol)
- Must include protocol (
http://orhttps://) - Must include hostname
- Path is optional but recommended
- Wildcards (
*) only supported at end of path - No query parameters or fragments in route patterns
agent.mtls
- Type: Object (optional, enabled by default)
- Description: Mutual TLS (mTLS) configuration for secure authentication
- Type: Boolean (optional)
- Default:
true - Description: Enable or disable mTLS authentication
- Type: String (required when mTLS enabled)
- Description: Path to client certificate file in PEM format
- Must be PEM-encoded X.509 certificate
- Maximum certificate lifespan: 180 days
- Certificate must be registered with Spotify
- Type: String (required when mTLS enabled)
- Description: Path to private key file in PEM format
- Must be PEM-encoded RSA or ECDSA private key
- For ECDSA: P-256 or P-384 elliptical curve (P-384 recommended)
- For RSA: Minimum 2048-bit key size (4096-bit recommended)
- Keep file secure with restricted permissions (400 or 600)
- Type: Boolean (optional)
- Default:
true - Description: Validate certificates when Agent starts
- Recommended to keep enabled
- Startup will fail if certificates are invalid or expired
- Helps catch certificate issues early
Environment Variables
CONFIG_PATH- Type: String
- Default:
./app-config.yaml - Description: Path to the Agent configuration file
- Type: Integer
- Default:
9466 - Description: Port for Prometheus metrics endpoint
- Type: String
- Default:
info - Valid values:
debug,info,warn,error - Description: Logging verbosity level
Environment Variable Substitution
Configuration files support environment variable substitution for sensitive values. Using Environment Variables Reference environment variables in configuration with${VAR_NAME}:
${VAR_NAME_FILE}: