# PATCH /web-server

First published 25 Oct 2026 (release 0.2.16) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the web-server group.

Set or clear Apache settings

- Who may call it: administrator
- Token scope, any of: settings, all
- Answers: 200 OK

Only administrators can call this operation. The token must have the settings scope.

In the WebServerSet request body, use set to add or update overrides and clear to remove them so Apache's own configuration and defaults determine the values again. You can change multiple settings in one request. UrbeStack writes the overrides to zz-urbestack-web-server.conf, which Apache reads after its own configuration files.

For the event MPM, you can change StartServers, ServerLimit, ThreadLimit, ThreadsPerChild, MaxRequestWorkers, MinSpareThreads, MaxSpareThreads, MaxConnectionsPerChild, and AsyncRequestWorkerFactor. The connection settings are Timeout, KeepAlive, KeepAliveTimeout, and MaxKeepAliveRequests. Setting names must contain 1 to 40 ASCII letters. After trimming surrounding whitespace, each value in set must contain 1 to 20 ASCII letters, digits, or periods. The API returns 400 if a name or value fails the format checks.

Timeout and KeepAliveTimeout accept seconds or milliseconds. For milliseconds, add the ms suffix, as in 300ms. AsyncRequestWorkerFactor accepts a decimal such as 1.5. KeepAlive accepts on, off, 1, 0, yes, no, true, or false in any letter case and normalizes the value to On or Off. The remaining settings take numbers.

UrbeStack tests the full Apache configuration with the updated file in place. If the test fails, UrbeStack restores the previous configuration and returns 400 with Apache's test output.

Set accept_warnings to true to save changes if Apache warns that it would adjust a value while reading the configuration, or if a graceful reload would retain ServerLimit or ThreadLimit and reduce another value to respect that limit. If either condition occurs and accept_warnings is false or omitted, the API returns 409 with the warnings and saves no changes. For example, Apache may adjust ThreadsPerChild if it exceeds ThreadLimit, or MaxRequestWorkers if it falls between multiples of ThreadsPerChild or exceeds ServerLimit multiplied by ThreadsPerChild.

By default, UrbeStack reloads Apache gracefully across all sites and lets requests in progress finish. Set restart to true for a full restart, which is required to apply changes to ServerLimit or ThreadLimit. A full restart drops open connections. If Apache fails to come back up, UrbeStack restores the previous file, starts Apache with it, and returns 502.

UrbeStack allows up to 280 seconds to apply the change. On success, the API returns 200 with WebServerSaved.

## As a command

- [urbestack-web-server-set](https://urbestack.com/docs/commands/urbestack-web-server-set.md): Sets or clears Apache settings in zz-urbestack-web-server.conf.

## Request body

JSON, the type [WebServerSet](https://urbestack.com/docs/api/types/WebServerSet.md).

- `accept_warnings` (boolean): Whether to save settings when Apache warns that it would adjust their values while reading the configuration.
- `clear` (array of string, matching ^[A-Za-z]{1,40}$)
- `restart` (boolean): Whether to request a full restart in place of a graceful reload. A full restart drops open connections.
- `set` (object of ARRAY(0x146e94190)): Mapping of directive names to values.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X PATCH "$API/web-server" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "accept_warnings": true,
    "clear": [
      "text"
    ],
    "restart": true,
    "set": {}
  }'
```

Response, 200 OK:

```
{
  "cleared": [
    "text"
  ],
  "file": "urbestack-panel-20260909T101500Z.json.enc",
  "outcome": "reloaded",
  "set": [
    {}
  ],
  "warnings": [
    "text"
  ]
}
```

## Errors

- 400: --set expects NAME=VALUE, got '<kv>'
- 400: <k> needs a value: a number, On or Off
- 400: <s.name> is not set here
- 400: Apache's configuration test fails with these values, so nothing was saved and Apache was not reloaded. Test output:\n<after.test>{words}
- 400: Nothing to change: give a setting to set or one to clear
- 400: Unknown setting '
- 400: Unknown setting '<raw>'
- 401: Authentication required
- 409: Apache does not read <path>, so a value set here would not be in force. The file is included from the panel's place for it; put back the Include that reads it
- 409: Apache is not known to this panel here: apache_ctl names no program
- 409: Apache would not run these values as written:\n
- 409: Apache's current configuration already fails its configuration test, so nothing can be saved until the test passes. Test output:\n<facts.test>{words}
