# Large menu upload limits

Menu scan uploads (including PDFs) are allowed up to **200 MB** in the app.
All layers below must allow at least that size or users see failures.

| Layer | Setting | Value | Location |
|-------|---------|-------|----------|
| Laravel | `max:` (kilobytes) | `204800` (200 MB) | `config/menu.php` → `StoreMenuIngestionRequest` |
| Vue client | `maxUploadBytes` | 200 MB | `MenuIngestion.vue` |
| PHP (Sail / local) | `upload_max_filesize` / `post_max_size` | `200M` / `210M` | `docker/php/zz-menu-uploads.ini` |
| PHP (cPanel / production) | same | `200M` / `210M` | `public/.user.ini` or MultiPHP INI Editor |
| **Nginx (cPanel reverse proxy)** | `client_max_body_size` | **`210m`** | `/etc/nginx/ea-nginx/settings.json` |

## Fixing `413 Request Entity Too Large` on cPanel

Production uses **cPanel ea-nginx as a reverse proxy in front of Apache**.
Nginx rejects oversized bodies with **413** before Apache/PHP/Laravel run.
Default `client_max_body_size` is **1m**.

Do **not** hand-edit generated site conf files under `/etc/nginx/conf.d/` — cPanel regenerates them. Use `settings.json` (official cPanel method).

### As root on the cPanel server

1. Edit `/etc/nginx/ea-nginx/settings.json` and set:

```json
"client_max_body_size": "210m"
```

Keep valid JSON (commas between keys). Example shape:

```json
{
  "client_max_body_size": "210m"
}
```

(Merge with any existing keys already in that file.)

2. Rebuild nginx config:

```bash
/usr/local/cpanel/scripts/ea-nginx config --global
```

Or in WHM: **Software → NGINX Manager → Rebuild Configuration**.

3. Confirm it applied:

```bash
grep client_max_body_size /etc/nginx/conf.d/ea-nginx.conf
```

You should see `client_max_body_size 210m;`.

### PHP on cPanel (after nginx)

Also raise PHP limits so the request is not truncated after nginx accepts it:

- Deploy `public/.user.ini` from this repo, **or**
- cPanel → **MultiPHP INI Editor** for the site’s PHP version:
  - `upload_max_filesize = 200M`
  - `post_max_size = 210M`

Optional Apache safety net (usually not the 413 source): ensure Apache `LimitRequestBody` is unset or ≥ 210 MB.

### Alternate: global conf include

If `settings.json` is unavailable on an older stack, create `/etc/nginx/conf.d/maxuploadsize.conf`:

```nginx
client_max_body_size 210m;
```

Then rebuild/reload via NGINX Manager or `ea-nginx config --global`. Prefer `settings.json` on current ea-nginx.

### Local Sail

Sail uses `artisan serve` (no nginx). Limits come from `docker/php/zz-menu-uploads.ini`.
