Loading…
Loading…
A backend profile defines how the platform connects to an upstream API, including endpoint, authentication, timeouts, and retries. Learn how to manage
A Backend Profile encapsulates all the configuration required for the platform to connect to a specific upstream API backend. Each profile is associated with a single Service and defines properties such as the backend's endpoint URL, authentication method, connection timeouts, and retry logic.
API publishers create and manage backend profiles to control how incoming requests to a Service are proxied to the appropriate upstream implementation. A single Service can have multiple backend profiles, allowing for different routing strategies (e.g., for different environments or versions) and A/B testing using routing weights.
This component is responsible for the persistence and management of BackendProfileRecord entities. It handles the Create, Read, Update, and Delete (CRUD) operations, including the secure, encrypted storage of credentials. All operations are strictly scoped to the authenticated user's tenant to prevent cross-tenant data access.
The BackendProfileRepository manages records in the s2r_backend_profile database table. The core logic revolves around validating, normalizing, and securely persisting profile data.
AND_TENANT_SCOPE). This ensures that an API publisher in one tenant cannot read, modify, or delete backend profiles belonging to another tenant.CredentialsCipher before being stored in the database. When a profile is read, the system attempts to decrypt this data. If decryption fails (e.g., due to a key rotation), the credentials field will be empty, and the operator must re-enter them.auth_type and mtls_enabled flag. This ensures that no extraneous or incorrect credential data is stored. For example, if auth_type is basic, only username and password fields are retained in the credentials object.To prevent stored credentials from being inadvertently sent to an unauthorized destination, the system enforces a "credential target guard". When updating a backend profile that has stored credentials, if you change a target-defining field, you must re-submit the credentials in the same update request.
The following fields define the credential target:
endpoint_urlhost_headeroauth2_token_endpointoauth2_client_idIf any of these fields are changed without providing the credentials payload, the update operation will fail with an error.
The following diagram illustrates the update logic, highlighting the credential target check.
flowchart TD
A[Start Profile Update] --> B{New credentials provided?};
B -->|Yes| C[Normalize & Encrypt new credentials];
B -->|No| D{Credential target changed?<br>(URL, Host, OAuth endpoint/ID)};
D -->|Yes| E[Reject update with error<br>"Re-enter the backend credentials..."];
D -->|No| F[Keep existing stored credentials];
C --> G[Prepare UPDATE statement];
F --> G;
G --> H[Execute UPDATE in database];
H --> I[End];
E --> I;Each Service can have one default_backend_profile_id.
setAsDefault flag set to true, it becomes the default for its associated Service.setAsDefault flag.A backend profile is defined by the following fields.
| Name | Type | Default (on create) | Required (on create) | Description |
|---|---|---|---|---|
id | UUID | (auto-generated) | N/A | The unique identifier for the backend profile. |
service_id | UUID | — | Yes | The ID of the Service this profile belongs to. |
profile_name | String | — | Yes | A human-readable name for the profile. |
endpoint_url | String | — | Yes | The base URL of the upstream backend API. |
wsdl_url | String | null | No | The URL to the backend's WSDL document. Used for health checks in wsdl mode. |
healthcheck_url | String | null | No | An explicit URL for health checks. Used when health_check_mode is explicit. |
health_check_mode | String | wsdl | No | The health check strategy. Valid values: wsdl, explicit. |
host_header | String | null | No | A specific value to use for the Host header when proxying requests. If not set, the host from endpoint_url is used. |
auth_type | String | — | Yes | The authentication method. See Authentication Types for valid values. |
mtls_enabled | Boolean | false | No | If true, enables mutual TLS authentication with the backend. Requires mTLS credentials to be provided. |
soap_namespace | String | null | No | The SOAP namespace to be used in proxied requests. |
soap_version | String | 1.1 | No | The SOAP version. Valid values: 1.1, 1.2. |
connection_timeout_ms | Integer | 1000 | No | Timeout in milliseconds for establishing a connection to the backend. Range: 1 to 120000. |
read_timeout_ms | Integer | 1000 | No | Timeout in milliseconds for waiting for data from the backend after a connection is established. Range: 1 to 120000. |
retry_count | Integer | 2 | No | The number of times to retry a request upon failure. Range: 0 to 10. |
retry_backoff_ms | Integer | 25 | No | The initial backoff delay in milliseconds before a retry. Range: 0 to 60000. |
routing_priority | Integer | 100 | No | The priority of this profile for routing decisions. Lower values are higher priority. Range: 0 to 100000. |
routing_weight | Integer | 1 | No | The weight for traffic distribution among profiles with the same priority. Range: 1 to 1000. |
active | Boolean | true | No | If true, this profile is eligible for routing traffic. |
extra_headers | List | null | No | A list of custom static headers to add to requests sent to the backend. See Extra Headers. |
oauth2_token_endpoint | String | null | Yes (if auth_type is oauth2_client_credentials) | The URL of the OAuth2 token endpoint. |
oauth2_client_id | String | null | Yes (if auth_type is oauth2_client_credentials) | The client ID for the OAuth2 client credentials flow. |
oauth2_scope | String | null | No | The scope(s) to request for the OAuth2 client credentials flow. |
oauth2_extra_params | List | null | No | A list of extra parameters to include in the OAuth2 token request body. See OAuth2 Extra Parameters. |
credentials | Map | null | Varies | A map containing sensitive credentials. The required fields depend on auth_type. See Credentials Object. |
setAsDefault | Boolean | false | No | A transient flag used only during create/update operations. If true, this profile will be set as the default for the service. |
actor | String | system | No | A transient identifier for the user or system performing the operation, used for auditing. |
The auth_type field determines the authentication mechanism used when connecting to the backend. The following values are supported:
none: No authentication is performed.basic: HTTP Basic Authentication. Requires username and password in the credentials object.bearer: Bearer Token Authentication. Requires bearerToken in the credentials object.api_key_header: API Key sent in a custom HTTP header. Requires apiKeyHeaderName and apiKeyValue in the credentials object.oauth2_client_credentials: OAuth 2.0 Client Credentials Grant Flow. Requires oauth2_token_endpoint, oauth2_client_id, and credentials.oauth2ClientSecret.NOTE
Older authentication types related to WS-Security were retired and are no longer supported.
The extra_headers field is a list of name-value pairs. Each item in the list is an object with name and value string properties.
"extra_headers": [
{
"name": "X-Custom-Header",
"value": "static-value"
}
]
WARNING
To protect against mis-routing of credentials, certain header names are restricted and cannot be used in extra_headers. These include host, x-forwarded-host, forwarded, and others that can influence request routing. Use the dedicated host_header field to specify the target host. An attempt to use a restricted header name will result in an error.
The oauth2_extra_params field is a list of name-value pairs to be included in the body of the token request for the oauth2_client_credentials flow. Each item is an object with name and value string properties.
"oauth2_extra_params": [
{
"name": "audience",
"value": "https://api.example.com"
}
]
The credentials object is a map containing sensitive data. Its structure depends on the chosen auth_type and whether mtls_enabled is true. The system only stores fields relevant to the selected configuration.
type: (String) Automatically added by the system to match the auth_type.username: (String) For basic auth.password: (String) For basic auth.bearerToken: (String) For bearer auth.apiKeyHeaderName: (String) For api_key_header auth. The name of the header.apiKeyValue: (String) For api_key_header auth. The value of the API key.oauth2ClientSecret: (String) For oauth2_client_credentials auth.extraHeaders: (List) A list of sensitive headers, structured like the main extra_headers field. These headers are stored encrypted. The same restricted header name rules apply.mtls: (Map) If mtls_enabled is true, this object contains the mTLS material (e.g., client key, client certificate). The source does not specify the exact structure of this map.When creating or updating a backend profile, you may encounter the following errors.
| Error Message / Condition | Trigger | Meaning |
|---|---|---|
profile_name is required | The profile_name field is null or blank on creation. | A profile must have a name. |
endpoint_url is required | The endpoint_url field is null or blank on creation. | A profile must have a target endpoint URL. |
auth_type is required | The auth_type field is null or blank. | An authentication type must be specified. |
unsupported auth_type: ... | The value for auth_type is not one of the supported types. | Correct the auth_type to a valid value. |
... must be between X and Y | A numeric field like connection_timeout_ms or retry_count is outside its allowed range. | Adjust the value to be within the specified bounds. |
service not found: ... | The service_id provided does not correspond to an existing service in the current tenant. | Ensure the service_id is correct and you have permission to access it. |
extra_headers cannot set '...': it chooses which host receives the request... | An item in extra_headers or credentials.extraHeaders uses a restricted header name like host. | Remove the restricted header. Use the host_header field if you need to override the Host header. |
oauth2_token_endpoint is required for auth_type=oauth2_client_credentials | auth_type is oauth2_client_credentials but oauth2_token_endpoint is missing. | Provide the token endpoint URL. |
oauth2_client_id is required for auth_type=oauth2_client_credentials | auth_type is oauth2_client_credentials but oauth2_client_id is missing. | Provide the OAuth2 client ID. |
credentials.oauth2ClientSecret is required for auth_type=oauth2_client_credentials | auth_type is oauth2_client_credentials but oauth2ClientSecret is missing from the credentials object. | Provide the client secret. |
The backend endpoint URL, Host header, OAuth2 token endpoint or OAuth2 client ID differs... | An update was attempted on a profile with stored credentials, changing a target-defining field (endpoint_url, host_header, etc.) without re-supplying the credentials object. | To change the target for stored credentials, you must provide the credentials again in the same update request to confirm the change. |
| Credentials are not readable | The encrypted credentials data in the database could not be decrypted. | This can happen after a system key rotation. The profile is still considered to have credentials set, but they are unusable. You must update the profile and re-enter the credentials. |