---
title: Backend
summary: >-
  A backend (also sometimes called an origin server) is a server identified by
  IP address or hostname, from which Fastly will fetch your content. There can
  be multiple backends attached to a service, but each backend is specific to
  one service. By default, if only one backend is defined in a service
  configuration, it will be used for all requests provided it meets the <a
  href="https://www.fastly.com/documentation/reference/api/vcl-services/condition">conditions</a>
  attached to it, if any. If multiple backends are defined, the backend that is
  used for a request is the one with the highest-priority condition attached to
  it, out of all conditions that this request satisfies. If multiple conditions
  match the request with the same (highest) priority, one is chosen arbitrarily.
  If there are no backends with conditions that match the request, then the
  backend without any conditions is chosen. If there are multiple such backends,
  one is chosen arbitrarily. The behavior described above can be modified by
  using the <code>auto_loadbalance</code> field described below. These endpoints
  can be used with static backends only, not <a
  href="https://www.fastly.com/documentation/guides/integrations/backends/#dynamic-backends">dynamic
  backends</a>.
url: https://www.fastly.com/documentation/reference/api/services/backend
---

A backend (also sometimes called an origin server) is a server identified by IP address or hostname, from which Fastly will fetch your content. There can be multiple backends attached to a service, but each backend is specific to one service. By default, if only one backend is defined in a service configuration, it will be used for all requests provided it meets the <a href="https://www.fastly.com/documentation/reference/api/vcl-services/condition">conditions</a> attached to it, if any. If multiple backends are defined, the backend that is used for a request is the one with the highest-priority condition attached to it, out of all conditions that this request satisfies. If multiple conditions match the request with the same (highest) priority, one is chosen arbitrarily. If there are no backends with conditions that match the request, then the backend without any conditions is chosen. If there are multiple such backends, one is chosen arbitrarily. The behavior described above can be modified by using the <code>auto_loadbalance</code> field described below. These endpoints can be used with static backends only, not <a href="https://www.fastly.com/documentation/guides/integrations/backends/#dynamic-backends">dynamic backends</a>.

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `address` | string | A hostname, IPv4, or IPv6 address for the backend. This is the preferred way to specify the location of your backend. |
| `auto_loadbalance` | boolean | Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a <code>request_condition</code> will be selected based on their <code>weight</code>. |
| `between_bytes_timeout` | integer | Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using <code>bereq.between_bytes_timeout</code>. |
| `client_cert` | string | Unused. |
| `comment` | string | A freeform descriptive note. |
| `connect_timeout` | integer | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic <code>503</code> response will be presented instead. May be set at runtime using <code>bereq.connect_timeout</code>. |
| `fetch_timeout` | integer | Maximum duration in milliseconds to wait for the entire response to be received after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic <code>503</code> response will be presented instead. May be set at runtime using <code>bereq.fetch_timeout</code>. |
| `first_byte_timeout` | integer | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic <code>503</code> response will be presented instead. May be set at runtime using <code>bereq.first_byte_timeout</code>. |
| `healthcheck` | string | The name of the healthcheck to use with this backend. |
| `hostname` | string | The hostname of the backend. May be used as an alternative to <code>address</code> to set the backend location. |
| `ipv4` | string | IPv4 address of the backend. May be used as an alternative to <code>address</code> to set the backend location. |
| `ipv6` | string | IPv6 address of the backend. May be used as an alternative to <code>address</code> to set the backend location. |
| `keepalive_time` | integer | How long (in seconds) to keep a persistent connection to the backend between requests. By default, Fastly keeps connections open as long as it can. |
| `max_conn` | integer | Maximum number of concurrent connections this backend will accept. |
| `max_lifetime` | integer | Maximum time from creation (in milliseconds) that a pooled HTTP keepalive connection will be eligible for reuse; 0 is treated as unlimited. |
| `max_tls_version` | string | Maximum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic <code>503</code> error response will be generated. |
| `max_use` | integer | Maximum number of requests allowed over a single, pooled HTTP keepalive connection to this backend; 0 is treated as unlimited. |
| `min_tls_version` | string | Minimum allowed TLS version on SSL connections to this backend. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic <code>503</code> error response will be generated. |
| `name` | string | The name of the backend. |
| `override_host` | string | If set, will replace the client-supplied HTTP <code>Host</code> header on connections to this backend. Applied after VCL has been processed, so this setting will take precedence over changing <code>bereq.http.Host</code> in VCL. |
| `port` | integer | Port on which the backend server is listening for connections from Fastly. Setting <code>port</code> to 80 or 443 will also set <code>use_ssl</code> automatically (to false and true respectively), unless explicitly overridden by setting <code>use_ssl</code> in the same request. |
| `prefer_ipv6` | boolean | Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services. |
| `request_condition` | string | Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any <code>auto_loadbalance</code> setting. By default, the first backend added to a service is selected for all requests. |
| `share_key` | string | Value that when shared across backends will enable those backends to share the same health check. |
| `shield` | string | Identifier of the POP to use as a <a href="https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/">shield</a>. |
| `ssl_ca_cert` | string | CA certificate attached to origin. |
| `ssl_cert_hostname` | string | Overrides <code>ssl_hostname</code>, but only for cert verification. Does not affect SNI at all. |
| `ssl_check_cert` | boolean | Be strict on checking SSL certs. |
| `ssl_ciphers` | string | List of <a href="https://www.openssl.org/docs/man1.1.1/man1/ciphers.html">OpenSSL ciphers</a> to support for connections to this origin. If your backend server is not able to negotiate a connection meeting this constraint, a synthetic <code>503</code> error response will be generated. |
| `ssl_client_cert` | string | Client certificate attached to origin. |
| `ssl_client_key` | string | Client key attached to origin. |
| `ssl_hostname` | string | Use <code>ssl_cert_hostname</code> and <code>ssl_sni_hostname</code> to configure certificate validation. |
| `ssl_sni_hostname` | string | Overrides <code>ssl_hostname</code>, but only for SNI in the handshake. Does not affect cert validation at all. |
| `tcp_keepalive_enable` | boolean | Whether to enable TCP keepalives for backend connections. Varnish defaults to using keepalives if this is unspecified. |
| `tcp_keepalive_interval` | integer | Interval in seconds between subsequent keepalive probes. |
| `tcp_keepalive_probes` | integer | Number of unacknowledged probes to send before considering the connection dead. |
| `tcp_keepalive_time` | integer | Interval in seconds between the last data packet sent and the first keepalive probe. |
| `use_ssl` | boolean | Whether or not to require TLS for connections to this backend. |
| `weight` | integer | Weight used to load balance this backend against others. May be any positive integer. If <code>auto_loadbalance</code> is true, the chance of this backend being selected is equal to its own weight over the sum of all weights for backends that have <code>auto_loadbalance</code> set to true. |
| `created_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `deleted_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `locked` | boolean | Indicates whether the version of the service this backend is attached to accepts edits. (Read-only) |
| `service_id` | string | Alphanumeric string identifying the service. (Read-only) |
| `updated_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `version` | integer | Integer identifying a service version. (Read-only) |

## API endpoints

### List backends

**GET** `/service/{service_id}/version/{version_id}/backend`

List all backends for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Create a backend

**POST** `/service/{service_id}/version/{version_id}/backend`

Create a backend for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Describe a backend

**GET** `/service/{service_id}/version/{version_id}/backend/{backend_name}`

Get the backend for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `backend_name` | string | path | Yes | The name of the backend. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Update a backend

**PUT** `/service/{service_id}/version/{version_id}/backend/{backend_name}`

Update the backend for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `backend_name` | string | path | Yes | The name of the backend. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Delete a backend

**DELETE** `/service/{service_id}/version/{version_id}/backend/{backend_name}`

Delete the backend for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `backend_name` | string | path | Yes | The name of the backend. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |
