---
title: "corestack_nginx_rules_validate"
url: https://docs.corefinity.com/mcp/tools/corestack_nginx_rules_validate
type: tool
last_updated: 2026-11-13
feature: nginx-rules
related:
  - https://docs.corefinity.com/api/reference/site-settings/check-site-nginx-rules.md
  - https://docs.corefinity.com/guides/sites/site-settings/web-server-rules.md
---
# corestack_nginx_rules_validate

**Check nginx rules.** 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. Scope: read.

- Scope: `read`
- Runs as a task: no

## 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.

## Inputs

- `site_id` (integer, ≥ 1, required): The environment row.
- `content` (object: `server`, `headers`, `php`, `http`, each text or null): The hooks to check: server, headers, php, http (text, or null for none); a hook left out is the current one. Required.
- `sandbox` (boolean): Also test with the environment's nginx (default true).

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "content": {
      "additionalProperties": false,
      "description": "The hooks to check: server, headers, php, http (text, or null for none); a hook left out is the current one. Required.",
      "properties": {
        "headers": {
          "type": [
            "string",
            "null"
          ]
        },
        "http": {
          "type": [
            "string",
            "null"
          ]
        },
        "php": {
          "type": [
            "string",
            "null"
          ]
        },
        "server": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "path_apps": {
      "description": "Path apps and gates to check, the whole list; left out: the saved ones.",
      "items": {
        "type": "object"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "render": {
      "description": "Also answer path_apps_rendered.",
      "type": "boolean"
    },
    "sandbox": {
      "description": "Also test with the environment's nginx (default true).",
      "type": "boolean"
    },
    "site_id": {
      "description": "The environment row.",
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "site_id"
  ],
  "type": "object"
}
```

## Refusals

- `too_large`: a hook is over its size limit.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another 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.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

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

## 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
  }
}
```

## Prompt

```text
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.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/sites/{site}/nginx-rules/validate](https://docs.corefinity.com/api/reference/site-settings/check-site-nginx-rules.md)
- Guide: [Web server rules](https://docs.corefinity.com/guides/sites/site-settings/web-server-rules.md)
