Kobaru
  1. Transparent Proxy
Kobaru
  • Kobaru.io Gateway API
    • Introduction
      • What is Kobaru?
      • Quick start
      • How x402 works
    • Integration
      • Standard x402 SDK
      • Advanced SDK
      • Transparent proxy integration
      • Direct API integration
    • Core Concepts
      • Available Chains and Assets
      • Payment schemes
      • Security
      • Usage models
    • Guides
      • Pricing your API
      • Going to Production
      • Testing with devnet
      • Bazaar discovery
    • API Reference
      • Error Handling
      • Get Supported Payment Kinds
      • Verify Payment Authorization
      • Settle Payment
    • Discovery
      • List Discovery Resources
    • Transparent Proxy
      • Overview - Transparent Proxy
      • Upstream authentication
      • Troubleshooting
      • Constraints and security
      • Capabilities and routes
      • Domain verification
      • Service setup
    • Schemas
      • SupportedResponse
      • ErrorResponse
      • UnauthorizedResponse
      • RateLimitResponse
      • VerifySuccessResponse
      • VerifyErrorResponse
      • SettleSuccessResponse
      • SettleErrorResponse
      • DiscoveryResourceItem
      • ListDiscoveryResourcesResponse
  1. Transparent Proxy

Upstream authentication

Secure your backend so that only Kobaru-proxied traffic is accepted. The proxy can inject an API key into every request it forwards to your upstream API.

Why use upstream authentication#

Without upstream auth, anyone who knows your backend URL can bypass the proxy and access your API directly. With it:
Only requests coming through Kobaru's payment gateway reach your backend
You can use your existing authentication middleware to validate the injected key
Direct access attempts fail because they don't have the key

How it works#

1.
You configure an API key and header format in the Console
2.
The key is encrypted before storage
3.
On each proxied request, the gateway decrypts the key and injects it as the configured header
4.
Your backend validates the key using your existing auth middleware

Configuration#

Located in the service create/edit dialogs under Upstream Authentication.

Settings#

FieldOptionsDescription
Upstream AuthenticationNone / API KeyWhether to inject authentication
Header FormatAuthorization: Bearer / X-API-Key / api-keyHow the key is sent to your backend
API KeyYour secretThe key to inject (encrypted before storage)

Header formats#

PresetHeader sent to your backend
Authorization: BearerAuthorization: Bearer <your-key>
X-API-KeyX-API-Key: <your-key>
api-keyapi-key: <your-key>

Header injection order#

The gateway processes headers in this order:
1.
The Authorization header is removed (prevents credential leakage to upstream)
2.
The Payment-Signature header is removed
3.
Your upstream API key is injected via the configured header
If the preset is Authorization: Bearer, the header is first cleared of the payment token, then set to your merchant key.

Testing your configuration#

The Console provides two testing methods to verify your upstream authentication works.

Health check (before saving)#

Tests a new or changed key before the service is saved. Available in both create and edit dialogs.
1.
The Console auto-derives a health check URL from your base URL (defaults to /health)
2.
You can edit the full URL
3.
Click Check to test the connection
4.
Shows the HTTP status and latency
This catches configuration errors before they affect live traffic.

Test connection (after saving)#

Tests the stored encrypted key for an existing service. Only available in the edit dialog when a key is already configured.
1.
Click Test Connection
2.
Choose a path to test (e.g., /health, /ping, /status)
3.
The Console decrypts the stored key and makes a real request to your backend
4.
Shows success/failure and HTTP status
Use this to verify the stored key still works, for example after rotating keys on your backend.

Comparison#

FeatureHealth checkTest connection
When availableCreate and editEdit only (key must exist)
What it testsNew/changed keyStored encrypted key
Service ID neededNoYes
URL controlFull URL editablePath only
Shows latencyYesNo
Auth header injectedNoYes (per config)

Security#

Keys are encrypted before database storage
Keys are never returned via the API (only hasProxyAuthKey: true/false)
Your keys are stored securely and decrypted only when needed for request forwarding

Next steps#

With your service and upstream auth configured, set up capabilities and routes to define pricing and payment methods.
Modified at 2026-02-10 21:50:25
Previous
Overview - Transparent Proxy
Next
Troubleshooting
Built with