---
layout: docs
page_title: Sidecar proxy configuration reference
description: >-
  Learn about default settings, customizable parameters, limitations, and lifecycle behaviors of the sidecar proxy.
---

# Sidecar proxy configuration reference

The `sidecar_service` block is a service definition that can contain most regular service definition fields. Refer to [Limitations](#limitations) for information about unsupported service definition fields for sidecar proxies.

Consul treats sidecar proxy service definitions as a root-level service definition. All fields are optional in nested definitions, which default to opinionated settings that are intended to reduce burden of setting up a sidecar proxy.

## Sidecar service defaults

The following fields are set by default on a sidecar service registration. With
[the exceptions noted](#limitations) any field may be overridden explicitly in
the `connect.sidecar_service` definition to customize the proxy registration.
The "parent" service refers to the service definition that embeds the sidecar
proxy.

- `id` - ID defaults to `<parent-service-id>-sidecar-proxy`. This value cannot
  be overridden as it is used to [manage the lifecycle](#lifecycle) of the
  registration.
- `name` - Defaults to `<parent-service-name>-sidecar-proxy`.
- `tags` - Defaults to the tags of the parent service.
- `meta` - Defaults to the service metadata of the parent service.
- `port` - Defaults to being auto-assigned from a configurable
  range specified by [`sidecar_min_port`](/consul/docs/reference/agent/configuration-file/general#sidecar_min_port)
  and [`sidecar_max_port`](/consul/docs/reference/agent/configuration-file/general#sidecar_max_port).
- `kind` - Defaults to `connect-proxy`. This value cannot be overridden.
- `check`, `checks` - By default we add a TCP check on the local address and
  port for the proxy, and a [service alias
  check](/consul/docs/register/health-check/vm#alias-checks) for the parent service. If either
  `check` or `checks` fields are set, only the provided checks are registered.
- `proxy.destination_service_name` - Defaults to the parent service name.
- `proxy.destination_service_id` - Defaults to the parent service ID.
- `proxy.local_service_address` - Defaults to `127.0.0.1`.
- `proxy.local_service_port` - Defaults to the parent service port.

### Example with overwritten configurations

In the following example, the `sidecar_service` macro sets baselines configurations for the proxy, but the [proxy
upstreams](/consul/docs/reference/proxy/connect-proxy#upstream-configuration-reference)
and [built-in proxy
configuration](/consul/docs/reference/proxy/built-in) fields contain custom values:

```json
{
  "name": "web",
  "port": 8080,
  "connect": {
    "sidecar_service": {
      "proxy": {
        "upstreams": [
          {
            "destination_name": "db",
            "local_bind_port": 9191
          }
        ],
        "config": {
          "handshake_timeout_ms": 1000
        }
      }
    }
  }
}
```

## Limitations

The following fields are not supported in the `connect.sidecar_service` block:

- `id` - Sidecar services get an ID assigned and it is an error to override
  this value. This ID is required to ensure that the agent can correctly deregister the sidecar service
  later when the parent service is removed.
- `kind` - Kind defaults to `connect-proxy` and there is no way to
  unset this behavior.
- `connect.sidecar_service` - Service definitions cannot be nested recursively.
- `connect.native` - The `kind` is fixed to `connect-proxy` and it is
  an error to register a `connect-proxy` that is also service mesh-native.
