Skip to content
v2.7

Proxy

Domain rules for functions and sites.

Domain rules for functions and sites.

Class Proxy: 8 methods (0 in @owbase/web, 8 in @owbase/node). The examples use the object form of the parameters; replace the values between < and > with your own.

List rules

GET /proxy/rules · method page

SDK: @owbase/node only

Get a list of all the proxy rules. You can use the query params to filter your results.

Parameter Type Required Description
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Access: API key with the rules.read scope.

@owbase/node
import { Client, Proxy } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const proxy = new Proxy(client);
const result = await proxy.listRules({
queries: [], // optional
total: false, // optional
});

Create API rule

POST /proxy/rules/api · method page

SDK: @owbase/node only

Create a new proxy rule for serving Owbase’s API on custom domain.

Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes.

Parameter Type Required Description
domain string yes Domain name.

Access: API key with the rules.write scope.

@owbase/node
import { Client, Proxy } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const proxy = new Proxy(client);
const result = await proxy.createAPIRule({
domain: 'example.com',
});

Create function rule

POST /proxy/rules/function · method page

SDK: @owbase/node only

Create a new proxy rule for executing Owbase Function on custom domain.

Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes.

Parameter Type Required Description
domain string yes Domain name.
functionId string yes ID of function to be executed.
branch string no Name of VCS branch to deploy changes automatically

Access: API key with the rules.write scope.

@owbase/node
import { Client, Proxy } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const proxy = new Proxy(client);
const result = await proxy.createFunctionRule({
domain: 'example.com',
functionId: '<FUNCTION_ID>',
branch: '<BRANCH>', // optional
});

Create redirect rule

POST /proxy/rules/redirect · method page

SDK: @owbase/node only

Create a new proxy rule for to redirect from custom domain to another domain.

Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes.

Parameter Type Required Description
domain string yes Domain name.
url string yes Target URL of redirection
statusCode StatusCode yes Status code of redirection Values: 301, 302, 307, 308.
resourceId string yes ID of parent resource.
resourceType ProxyResourceType yes Type of parent resource. Values: site, function.

Access: API key with the rules.write scope.

@owbase/node
import { Client, Proxy, StatusCode, ProxyResourceType } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const proxy = new Proxy(client);
const result = await proxy.createRedirectRule({
domain: 'example.com',
url: 'https://example.com',
statusCode: StatusCode.MovedPermanently,
resourceId: '<RESOURCE_ID>',
resourceType: ProxyResourceType.Site,
});

Create site rule

POST /proxy/rules/site · method page

SDK: @owbase/node only

Create a new proxy rule for serving Owbase Site on custom domain.

Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes.

Parameter Type Required Description
domain string yes Domain name.
siteId string yes ID of site to be executed.

Access: API key with the rules.write scope.

@owbase/node
import { Client, Proxy } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const proxy = new Proxy(client);
const result = await proxy.createSiteRule({
domain: 'my-store.sites.owbase.dev',
siteId: '<SITE_ID>',
});

Get rule

GET /proxy/rules/{ruleId} · method page

SDK: @owbase/node only

Get a proxy rule by its unique ID.

Parameter Type Required Description
ruleId string yes Rule ID.

Access: API key with the rules.read scope.

@owbase/node
import { Client, Proxy } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const proxy = new Proxy(client);
const result = await proxy.getRule({
ruleId: '<RULE_ID>',
});

Delete rule

DELETE /proxy/rules/{ruleId} · method page

SDK: @owbase/node only

Delete a proxy rule by its unique ID.

Parameter Type Required Description
ruleId string yes Rule ID.

Access: API key with the rules.write scope.

@owbase/node
import { Client, Proxy } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const proxy = new Proxy(client);
const result = await proxy.deleteRule({
ruleId: '<RULE_ID>',
});

Update rule status

PATCH /proxy/rules/{ruleId}/status · method page

SDK: @owbase/node only

If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background.

Parameter Type Required Description
ruleId string yes Rule ID.

Access: API key with the rules.write scope.

@owbase/node
import { Client, Proxy } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const proxy = new Proxy(client);
const result = await proxy.updateRuleStatus({
ruleId: '<RULE_ID>',
});

The descriptions on this page come from the server API specification (BSD-3-Clause license), and the examples come from the SDK generator (MIT license). The full notices are in the NOTICE file of the @owbase/web and @owbase/node packages.

Was this page helpful?