# Advanced Proxy Configuration

All configuration is done via environment variables in the `.env` file. After changing any value, restart the service:

```
systemctl restart pullrequest-proxy
```

### Repository Caching & Performance

| Variable           | Default | Description                                                                                                                                                                                                              |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `NUM_REPO_WORKERS` | `5`     | Number of concurrent repository worker slots. Each worker can clone/process one repo at a time. Increase if reviews are queuing up because all workers are busy.                                                         |
| `REPO_CACHE_LIMIT` | `10`    | Maximum number of repos kept cached on disk after processing. Cached repos don't need re-cloning on subsequent reviews, which significantly speeds up repeated reviews for the same repo. Set to `0` to disable caching. |

**Disk space planning:** The proxy can hold up to `NUM_REPO_WORKERS + REPO_CACHE_LIMIT` repos on disk simultaneously (active + cached). When disk usage exceeds **80%**, the proxy automatically evicts the least-recently-used cached repos to free space.

With the default settings (5 workers + 10 cached), up to 15 repos may be on disk at once. Size your disk based on the average size of your repositories. The installation docs recommend **200 GB** as a starting point.

#### PII Anonymization

| Variable                  | Default | Description                                                                                                                                                    |
| ------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PII_ANONYMIZATION_SALT`  | —       | Set to any secret string to enable PII anonymization. When enabled, personally identifiable information is hashed before being sent to the PullRequest server. |
| `PII_ANONYMIZE_USER_INFO` | `false` | Set to `true` to anonymize user info (usernames, display names, emails). Requires `PII_ANONYMIZATION_SALT` to be set.                                          |

#### HTTP Proxy

Standard UNIX proxy environment variables are supported for routing outbound traffic through a corporate proxy:

| Variable                      | Description                                        |
| ----------------------------- | -------------------------------------------------- |
| `http_proxy` / `HTTP_PROXY`   | Proxy URL for HTTP traffic.                        |
| `https_proxy` / `HTTPS_PROXY` | Proxy URL for HTTPS traffic.                       |
| `no_proxy` / `NO_PROXY`       | Comma-separated list of hosts to bypass the proxy. |

### Complete `.env` Variable Reference

For convenience, here is every supported variable. Variables marked with \* are covered in the setup walkthrough.

| Variable                      | Default                       | Required | Setup Step                                                                                                |
| ----------------------------- | ----------------------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `PULLREQUEST_TOKEN`           | —                             | Yes      | [Connecting Proxy](https://docs.pullrequest.com/on-premise-server/connecting-your-proxy-with-pullrequest) |
| `PULLREQUEST_SECRET`          | —                             | Yes      | [Connecting Proxy](https://docs.pullrequest.com/on-premise-server/connecting-your-proxy-with-pullrequest) |
| `PULLREQUEST_BASE_URL`        | `https://app.pullrequest.com` | No       | —                                                                                                         |
| `PROVIDER_TYPE`               | —                             | Yes      | [Configure Posting User](https://docs.pullrequest.com/on-premise-server/configure-posting-user)           |
| `PROVIDER_BASE_URL`           | —                             | Yes      | [Configure Posting User](https://docs.pullrequest.com/on-premise-server/configure-posting-user)           |
| `PROVIDER_USERNAME`           | —                             | Yes      | [Configure Posting User](https://docs.pullrequest.com/on-premise-server/configure-posting-user)           |
| `PROVIDER_ACCESS_TOKEN`       | —                             | Yes      | [Configure Posting User](https://docs.pullrequest.com/on-premise-server/configure-posting-user)           |
| `PROVIDER_WEBHOOK_SECRET`     | —                             | No       | [Configure Webhooks](https://docs.pullrequest.com/on-premise-server/configure-webhooks)                   |
| `USE_TLS`                     | `false`                       | No       | [Configuring SSL](https://docs.pullrequest.com/on-premise-server/configuring-ssl)                         |
| `TLS_CERT_PATH`               | —                             | If TLS   | [Configuring SSL](https://docs.pullrequest.com/on-premise-server/configuring-ssl)                         |
| `TLS_KEY_PATH`                | —                             | If TLS   | [Configuring SSL](https://docs.pullrequest.com/on-premise-server/configuring-ssl)                         |
| `DEBUG`                       | `false`                       | No       | —                                                                                                         |
| `SERVER_PORT`                 | `5012`                        | No       | —                                                                                                         |
| `NUM_REPO_WORKERS`            | `5`                           | No       | This page                                                                                                 |
| `REPO_CACHE_LIMIT`            | `10`                          | No       | This page                                                                                                 |
| `PII_ANONYMIZATION_SALT`      | —                             | No       | This page                                                                                                 |
| `PII_ANONYMIZE_USER_INFO`     | `false`                       | No       | This page                                                                                                 |
| `http_proxy` / `HTTP_PROXY`   | —                             | No       | [Installing Proxy](https://docs.pullrequest.com/on-premise-server/installing-the-pullrequest-proxy)       |
| `https_proxy` / `HTTPS_PROXY` | —                             | No       | [Installing Proxy](https://docs.pullrequest.com/on-premise-server/installing-the-pullrequest-proxy)       |
| `no_proxy` / `NO_PROXY`       | —                             | No       | [Installing Proxy](https://docs.pullrequest.com/on-premise-server/installing-the-pullrequest-proxy)       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pullrequest.com/on-premise-server/advanced-proxy-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
