# redirect

## Summary

Redirects specify how URLs may need to be rewritten. Each Redirect has a name, a regex that matches the requested URL, a to indicating how the url should be rewritten, and a flag to indicate how the redirect will be handled by the proxying layer.

### Example object

```javascript
{
  "name": "force-https",
  "from": "(.*)",
  "to": "https://$1",
  "redirect_type": "permanent"
}
```

### Fields

#### `name`

Common name for this redirect, e.g. "force-https".

#### `from`

Regex pattern to match against incoming request URLs. Capture groups set here can be used in the [to](#to) field.

#### `to`

New URL of the redirect. Can be direct string ("[https://localhost:443](https://localhost)) or reference capture groups from the [from](#from) field ("[https://localhost:$1](https://localhost/:$1)").

#### `redirect_type`

One of "permanent" or "temporary". Selection "permanent" will set the response code to 301, "temporary" will be 302.

#### `header_constraints`

Array of [Header Constraints](header_constraint) that must match for the redirect to take effect.
