Get the Nginx rules policy
Answers what Nginx rules may contain: the directives each hook takes, the ones that are refused and why, and the limits. Send site for the policy of one site, or platform for a platform in general. The answer carries an ETag; send it back in If-None-Match and an unchanged policy answers 304 with no body.
Query parameters
The id of a site row: the policy for its platform and the hooks it can use. A site you cannot see answers 404. At least 1.
A platform, when site is not sent.
laravelmagento2phpshopwareshopware5wordpressHeaders
The ETag of an earlier answer.
Returns
200 The policy. The lists are shortened here.
304 The policy has not changed since the ETag sent in If-None-Match. No body.
Fields of the 200 answer
The directives that may be used.
Fields of each item
How many arguments it takes.
Where in a hook it may stand.
Response headers the platform sets (fixed), frames (framing) or governs (governed).
Fields
The hooks the policy is for.
The limits the rules are held to.
Fields
The largest value each buffer directive may take, in bytes.
What path apps may contain. Present while path apps are on for your company.
Fields of each item
Directives that are refused, each with why.
Fields of each item
Name prefixes kept for the platform.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
422 | invalid | Fix the field named in field; errors says why. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl https://manage.corefinity.com/api/corestack/nginx-rules/policy \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json"use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->get('https://manage.corefinity.com/api/corestack/nginx-rules/policy');
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/nginx-rules/policy', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
},
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.get(
"https://manage.corefinity.com/api/corestack/nginx-rules/policy",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
)
data = res.json() if res.content else None{
"directives": [
{
"args": [
"2",
"3"
],
"checks": [
"add_header"
],
"contexts": [
"headers",
"location",
"location_if",
"php"
],
"doc": null,
"hooks": [
"server",
"headers",
"php"
],
"name": "add_header",
"prefix": false
}
],
"header_governed": {
"fixed": [
"X-Content-Type-Options",
"Referrer-Policy",
"X-Frame-Options",
"Strict-Transport-Security"
],
"framing": [
"Content-Type",
"Content-Length",
"Server"
],
"governed": [
"Cache-Control",
"CDN-Cache-Control",
"Cloudflare-CDN-Cache-Control",
"Surrogate-Control",
"X-Robots-Tag"
]
},
"hooks": [
"server",
"headers",
"php",
"http"
],
"limits": {
"buffers_total_max": 4194304,
"hook_file_bytes": 65536,
"keepalive": 32,
"lines_warn": 1500,
"location_nesting": 3,
"map_entries": 1000,
"max_lines": 2000,
"max_locations": 200,
"max_regex": 512,
"size_caps": {
"client_body_buffer_size": 1048576,
"proxy_buffer_size": 262144,
"proxy_busy_buffers_size": 1048576
},
"verify_paths": 5,
"zone_total_bytes": 10485760
},
"platform_headers": [
{
"name": "X-Content-Type-Options",
"value": "nosniff"
}
],
"platforms": [
"wordpress"
],
"policy_version": 6,
"rate_limit_presets": [],
"refused": [
{
"context": null,
"hook": null,
"message": "This module is not loaded by the platform's nginx.",
"name": "*_by_lua*",
"reason": "module_not_loaded"
}
],
"reserved_prefixes": [
"cf_"
],
"static_extensions": [
"css",
"js",
"png",
"jpg",
"svg",
"woff2",
"pdf"
]
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "invalid",
"errors": {
"platform": [
"Choose one of the platforms: laravel, magento2, php, shopware, shopware5, wordpress."
]
},
"field": "platform",
"message": "Choose one of the platforms: laravel, magento2, php, shopware, shopware5, wordpress.",
"reason": "invalid"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}