CorefinityCorefinityDocs
Open the Control PanelControl Panel
Web server rules · 2 of 14

corestack_nginx_rules_validate

Check nginx rules.

Scope readNo secrets returned
On this page

When to use it

Check custom nginx rules for an environment row before saving them: the policy's diagnostics with hook, line and column, then (sandbox, on by default) a real nginx -t with the environment's own nginx in a separate unprivileged pod. Hooks left out of content are the current ones. Nothing changes; pass the answer's test_id to corestack_nginx_rules_update with the same content to reuse a passed test.

A site whose runtime revision the policy has no model for answers every hook with runtime_model_missing at line 1, column 1, naming the revision: the Control Panel cannot check the file against rules the site does not run, and support moves the site to a supported revision. When the rules need the environment's runtime update and the platform has no model for the revision it would move to, every hook answers runtime_model_missing naming that revision 'after this change': support moves the site to a supported revision.

A platform rate-limit preset (limit_req zone=cf_rl_*) on an environment whose runtime does not support the presets is the error limit_zone_unknown.

The answer: diagnostics (each hook, line and column in the hook's file — the editor's line plus the two banner lines —, severity error / warning, code, message, and fix where one applies), policy_version, and sandbox: null when the policy found errors, when sandbox was false, or when the rules need the one-time runtime update (the current nginx cannot load them); otherwise {status, test_id, output, reason} with status passed, failed, unavailable (the environment is not running), timed_out or error. The wait for the sandbox is bounded (under a minute). The sandbox's diagnostics point into your rules: a warning nginx gives about the platform's own configuration, which no rule can change, is left out of diagnostics and stays in sandbox.output; an error is always kept, wherever nginx reports it, because it fails the test.

An http upstream whose name starts with cf_, in any case, is the error upstream_name_reserved at the upstream's line: those names belong to the platform's own upstreams, so give yours another name.

Ask for it

Prompt
Using the Corefinity MCP server, call corestack_nginx_rules_validate with site_id 4211, content {"server":"location /wp-content/uploads/private/ {\n    deny all;\n}\n"}. (Check nginx rules.) Tell me what it returned.

Inputs

contentobject

The hooks to check: server, headers, php, http (text, or null for none); a hook left out is the current one. Required.

Fields
headersstring or null
httpstring or null
phpstring or null
serverstring or null
path_appsarray of objects or null

Path apps and gates to check, the whole list; left out: the saved ones.

renderboolean

Also answer path_apps_rendered.

sandboxboolean

Also test with the environment's nginx (default true).

site_idintegerRequired

The environment row. At least 1.

Example call

tools/call
{
  "name": "corestack_nginx_rules_validate",
  "arguments": {
    "site_id": 4211,
    "content": {
      "server": "location /wp-content/uploads/private/ {\n    deny all;\n}\n"
    }
  }
}

If it is refused

ReasonWhat to do
too_largeA hook is over its size limit.
managed_elsewhereAnother control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
invalid_argumentsThe arguments do not match the tool's input schema, or the Control Panel refused a field. Fix the fields named in the answer and call again.
tenant_mismatchThe object does not exist or the token may not see it. Check the id.
scope_requiredThe token lacks a scope this call needs. Open the link in the answer to add it, then call again.
pin_refusedThe grant is limited to chosen clusters, sites or environments, and this call is outside them. Open the link in the answer to widen it.
rate_limitedToo many calls. Wait for the number of seconds the answer names.
temporarily_unavailableThe Control Panel could not answer just now. Nothing was started; try again shortly.
internal_errorSomething went wrong on our side. Quote the trace id to support.

Path apps

Send path_apps (the whole list, as corestack_nginx_rules_update takes it) to check path apps and gates with the hooks; left out, the saved ones are checked with the hooks, and content may be left out when you send path_apps. Each refused record is a diagnostic with hook path_apps, the record id, the field and the code; a custom server rule that would shadow a path app is path_app_location_conflict on the server hook, naming the record. With render: true the answer also carries path_apps_rendered: the nginx the list becomes (front and back; http for Corefinity staff), or null while a record is refused. A proxy's host name is looked up as at save: a name answering an internal address is refused (path_app_proxy_target), one that does not resolve yet is the warning path_app_proxy_unresolved.

  • links: a link target on a WordPress site may be shared/wp-content/uploads or a folder below it; the rest of shared/wp-content and every other code folder stays refused (path_app_link_outside on links.<i>.target). Validate checks the record only: whether the link exists in the environment is checked at save.

Inputs while path apps are on

  • path_apps (list of path app and gate records, as corestack_nginx_rules_update takes them): The path apps and gates to check: the whole list, as corestack_nginx_rules_update takes it. Left out: the saved ones (content may then be left out too).
  • render (boolean): Also answer path_apps_rendered: the nginx the path apps become (default false).

Example

JSON
{
  "name": "corestack_nginx_rules_validate",
  "arguments": {
    "site_id": 4211,
    "path_apps": [
      {"type": "gate", "prefix": "/rest/", "ips": ["203.0.113.10"]},
      {"type": "proxy", "prefix": "/help/", "proxy": {"url": "https://help.example.net", "path": "strip"}, "rate": {"per_second": 20, "burst": 100}}
    ],
    "render": true,
    "sandbox": false
  }
}

The same task elsewhere

Was this helpful?
Open in ClaudeOpen in ChatGPT