# Same proxy string repeated many times

Source: https://findproxyforurl.net/rules/repeated-proxy-string-literal/ · last updated 2026-10-04

Rule PAC-B005 (`repeated-proxy-string-literal`), severity info, category: Best practice and maintainability.

Writing "PROXY proxy.corp.example:8080" in a dozen places means a dozen edits when the proxy moves and a dozen chances for a typo in one of them.

## Why it matters

Proxy addresses change (migrations, failover redesign, port changes). When the literal is
repeated, one missed occurrence sends part of the traffic to the old address and the
difference is only noticed when that proxy is decommissioned. A top-level `var` makes the
change atomic and makes the file's routing targets visible at a glance.


## How to fix

var PROXY = "PROXY proxy.corp.example:8080"; and return PROXY everywhere.

## Bad

```js
function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, ".corp.example")) { return "DIRECT"; }
  if (dnsDomainIs(host, ".partner.example")) { return "PROXY proxy.corp.example:8080"; }
  if (dnsDomainIs(host, ".lab.example")) { return "PROXY proxy.corp.example:8080"; }
  return "PROXY proxy.corp.example:8080";
}
```

## Good

```js
var PROXY = "PROXY proxy.corp.example:8080";
function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, ".corp.example")) { return "DIRECT"; }
  return PROXY;
}
```
