---
title: "Get the Nginx rules policy"
url: https://docs.corefinity.com/api/reference/site-settings/get-nginx-policy
type: endpoint
last_updated: 2026-11-13
feature: nginx-rules
related:
  - https://docs.corefinity.com/guides/sites/site-settings/web-server-rules.md
  - https://docs.corefinity.com/mcp/tools/corestack_nginx_policy_get.md
---
# 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.

```http
GET /api/corestack/nginx-rules/policy
```

- Scope: `read`
- Two-factor: required on your account (all)
- Rate limit: 120 a minute
- Try it in the console: on

## Query parameters

- `site` (integer): The id of a site row: the policy for its platform and the hooks it can use. A site you cannot see answers `404`.
- `platform` (string): A platform, when `site` is not sent.

## Header parameters

- `If-None-Match` (string): The `ETag` of an earlier answer.

## Request

### curl

```bash
curl https://manage.corefinity.com/api/corestack/nginx-rules/policy \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json"
```

### PHP

```php
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();
```

### Node

```javascript
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);
```

### Python

```python
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
```

## Responses

### 200 The policy. The lists are shortened here.

```json
{
  "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"
  ]
}
```

### 304 The policy has not changed since the `ETag` sent in `If-None-Match`. No body.

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the scope (`scope_required`, with the `scope` to use), or your company requires two-factor authentication and you have not set it up. For routes outside Managed Clusters.

```json
{
  "code": "company_unavailable",
  "message": "Your company is unavailable.",
  "reason": "company_unavailable"
}
```

### 404 The id does not exist or is something you cannot see, or the feature is not on for your company (`feature_off`).

```json
{
  "code": "feature_off",
  "message": "Not found.",
  "reason": "feature_off"
}
```

### 422 `site` is not an id, or `platform` is not one of the platforms (`invalid`).

```json
{
  "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"
}
```

### 429 Too many requests (`rate_limited`). Wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many requests. Try again in 60 seconds.",
  "reason": "rate_limited",
  "retry_after_seconds": 60
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | 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`. |

## The same task elsewhere

- Guide: [Web server rules](https://docs.corefinity.com/guides/sites/site-settings/web-server-rules.md)
- MCP tool: [`corestack_nginx_policy_get`](https://docs.corefinity.com/mcp/tools/corestack_nginx_policy_get.md)
