Application network access
Use this route to define which IP addresses can reach a public HTTP application. The configuration fully replaces the current lists.
Authentication and permissions
Accepts an organization API Key (x-api-key: znf_... or Authorization: Bearer znf_...) or a user token with x-organization-id. Requires project.network.update on project:<project-id>; owner has full access.
Project requirements:
- be an HTTP application;
- have public exposure (see Project information);
- be on a plan with
capabilities.network_access: truein theGET /v1/project/planscatalog.
Limit: 10 requests per minute.
Update the lists
PATCH /v1/project/:id/network-access| Field | Type | Required | Description |
|---|---|---|---|
network_access.ingress_white_list | array | Yes | Allowed ranges, 1 to 10 items for public projects; to not restrict, send [{ "cidr": "0.0.0.0/0", "description": "Any IP" }] ([] is only valid for private projects) |
network_access.ingress_black_list | array | Yes | Blocked ranges, up to 200 items; use [] for none |
*.cidr | string | Yes | IPv4 or IPv6 range in CIDR notation, such as 203.0.113.0/24, 198.51.100.7/32 or 2001:db8::/32. An IP without a prefix becomes /32 or /128 |
*.description | string | Yes | Rule label, from 1 to 256 characters |
{
"network_access": {
"ingress_white_list": [
{ "cidr": "203.0.113.0/24", "description": "Office" },
{ "cidr": "198.51.100.7/32", "description": "CI server" }
],
"ingress_black_list": []
}
}{
"status": "success",
"message": "updated the network access with success"
}How rules are evaluated
ingress_white_listdefines who can access: only the listed IPs and ranges get in. To keep the application open to everyone, use0.0.0.0/0.ingress_black_listblocks specific IPs and ranges, even when they are inside an allowed range, such as0.0.0.0/0.- For public projects,
ingress_white_listneeds at least one item;[]is only accepted for private projects. To not restrict, send0.0.0.0/0in the allow list and useingress_black_listto block what you want.
IPv4 and IPv6 are accepted: ranges such as 999.1.1.1/32 or 10.0.0.0/33 are rejected with 400. See usage examples in Network access.
Errors
| Code | Situation |
|---|---|
400 | Invalid body (missing list, invalid CIDR, or empty description) |
400 NETWORK_RULES_LIMIT_EXCEEDED | More than 10 items in the allow list or more than 200 in the block list |
403 PROTECTION_NOT_AVAILABLE_ON_PLAN | Plan without the feature |
404 | Project not found |
409 | Project with private exposure (project is not publicly exposed) or PROJECT_STATE_CONFLICT, when the application does not have a running version yet (for example, a Git project before its first build) |
422 | PROJECT_OPERATION_NOT_SUPPORTED: the project is not an HTTP application |
429 | Rate limit exceeded |
500 | Failure applying the rules; try again |
Example
curl -X PATCH "https://api.zenifra.com/v1/project/6650f1a2b3c4d5e6f7a8b9c0/network-access" \
-H "x-api-key: znf_..." \
-H "Content-Type: application/json" \
-d '{"network_access": {"ingress_white_list": [{"cidr": "0.0.0.0/0", "description": "Public access"}], "ingress_black_list": []}}'Next steps
- Block countries and robots in App protection.
- Set the rules at creation with
config.network_accessin Create, list, and delete projects. - Configure the application's domain and subdomain.
- Review security practices.
Last updated on
Project Domain
Change the subdomain of a public HTTP project through the Zenifra API and set up to 20 custom domains, with naming rules, DNS records, and common errors.
App protection
Configure allowed IPs, countries, robots and exempt paths of an HTTP application through the Zenifra API, and block IPs, countries or robots in one call.