---
title: BackendOptions
summary: BackendOption is a builder for the configuration of a dynamic backend.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/struct.BackendOptions/
---

**Kind:** Struct  
**Module:** [fsthttp](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L62

```go
type BackendOptions struct {
	// contains filtered or unexported fields
}
```

BackendOption is a builder for the configuration of a dynamic backend.

## Methods

### BetweenBytesTimeout

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L271

```go
func (b *BackendOptions) BetweenBytesTimeout(t time.Duration) *BackendOptions
```

BetweenBytesTimeout sets the maximum duration that Fastly will wait while receiving no data on a download from a backend.

**Parameters**

- `t`: `time.Duration`

**Returns**

`*BackendOptions`

### CACert

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L329

```go
func (b *BackendOptions) CACert(cert string) *BackendOptions
```

CACert sets the CA certificate to use when checking the validity of the backend.
Setting this will enable SSL for the connection as a side effect.

If CACert is not provided (default), the backend's certificate is validated using a set of public root CAs.

**Parameters**

- `cert`: `string`

**Returns**

`*BackendOptions`

### CertHostname

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L315

```go
func (b *BackendOptions) CertHostname(host string) *BackendOptions
```

CertHostname sets the hostname that the server certificate should declare.
Setting this will enable SSL for the connection as a side effect.

If CertHostname is not provided (default), the server certificate's hostname can have any value.

**Parameters**

- `host`: `string`

**Returns**

`*BackendOptions`

### Ciphers

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L341

```go
func (b *BackendOptions) Ciphers(ciphers string) *BackendOptions
```

Ciphers sets the list of OpenSSL ciphers to support for connections to this origin.
Setting this will enable SSL for the connection as a side effect.

**Parameters**

- `ciphers`: `string`

**Returns**

`*BackendOptions`

### ClientCertificate

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L365

```go
func (b *BackendOptions) ClientCertificate(certificate string, key secretstore.Secret) *BackendOptions
```

ClientCertificate sets the client certificate to be provided to the server as part of the SSL handshake.
Setting this will enable SSL for the connection as a side effect.

**Parameters**

- `certificate`: `string`
- `key`: `secretstore.Secret`

**Returns**

`*BackendOptions`

### ConnectTimeout

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L251

```go
func (b *BackendOptions) ConnectTimeout(t time.Duration) *BackendOptions
```

ConnectTimeout sets the maximum duration to wait for a connection to this backend to be established.

**Parameters**

- `t`: `time.Duration`

**Returns**

`*BackendOptions`

### FirstByteTimeout

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L261

```go
func (b *BackendOptions) FirstByteTimeout(t time.Duration) *BackendOptions
```

FirstByteTimeout sets the maximum duration to wait for the server response to begin after a TCP connection is established and the request has been sent.

**Parameters**

- `t`: `time.Duration`

**Returns**

`*BackendOptions`

### Healthcheck

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L489

```go
func (b *BackendOptions) Healthcheck(h *BackendHealthcheckOptions) *BackendOptions
```

Healthcheck sets the backend health check configuration

NOTE: Support for this feature is experimental and may be removed at any time.

**Parameters**

- `h`: `*BackendHealthcheckOptions`

**Returns**

`*BackendOptions`

### HostOverride

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L245

```go
func (b *BackendOptions) HostOverride(host string) *BackendOptions
```

HostOverride sets the HTTP Host header on connections to this backend.

**Parameters**

- `host`: `string`

**Returns**

`*BackendOptions`

### HTTPKeepaliveTime

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L388

```go
func (b *BackendOptions) HTTPKeepaliveTime(t time.Duration) *BackendOptions
```

HTTPKeepaliveTime configures how long to allow HTTP connections to remain
idle in a connection pool before it should be considered closed.

**Parameters**

- `t`: `time.Duration`

**Returns**

`*BackendOptions`

### MaxConnections

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L451

```go
func (b *BackendOptions) MaxConnections(count uint32) *BackendOptions
```

MaxConnections sets how many connections to allow in the connection pool for this backend.

`0` is treated as unlimited. The default is `200`.

Note that this limit is best determined experimentally, since the total number of
connections to the backend will depend on POP sizes, HTTP keepalive limits, and the traffic
patterns for individual POPs.

**Parameters**

- `count`: `uint32`

**Returns**

`*BackendOptions`

### MaxLifetime

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L468

```go
func (b *BackendOptions) MaxLifetime(t time.Duration) *BackendOptions
```

MaxLifetime sets an upper bound for how long a pooled HTTP keepalive connection is allowed to have
been open before we stop trying to reuse it.

0ms is treated as unlimited. The default is 0ms.

**Parameters**

- `t`: `time.Duration`

**Returns**

`*BackendOptions`

### MaxUse

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L459

```go
func (b *BackendOptions) MaxUse(count uint32) *BackendOptions
```

MaxUse sets how many times an HTTP keepalive connection can be reused in a connection pool.

`0` is treated as unlimited. The default is `0`.

**Parameters**

- `count`: `uint32`

**Returns**

`*BackendOptions`

### PoolConnections

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L381

```go
func (b *BackendOptions) PoolConnections(poolingOn bool) *BackendOptions
```

PoolConnections allows users to turn connection pooling on or off for the
backend. Pooling allows the Compute platform to reuse connections across
multiple executions, resulting in lower resource use at the server (because it
does not need to repeat the TCP handhsake and TLS authentication when the
connection is reused). The default is to pool connections. Set this to false
to create a new connection to the backend for every incoming request.

**Parameters**

- `poolingOn`: `bool`

**Returns**

`*BackendOptions`

### PreferIPV6

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L481

```go
func (b *BackendOptions) PreferIPV6(v bool) *BackendOptions
```

PreferIPV6 sets whether to prefer trying IPv6 connections first before IPv4 when a hostname
has both A and AAAA records.

This defaults to `true`.

**Parameters**

- `v`: `bool`

**Returns**

`*BackendOptions`

### SNIHostname

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L353

```go
func (b *BackendOptions) SNIHostname(host string) *BackendOptions
```

SNIHostname sets the SNI hostname to use on connections to this backend.
Setting this will enable SSL for the connection as a side effect.

**Parameters**

- `host`: `string`

**Returns**

`*BackendOptions`

### SSLMaxVersion

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L305

```go
func (b *BackendOptions) SSLMaxVersion(max TLSVersion) *BackendOptions
```

SSLMaxVersion sets the maximum allowed TLS version on SSL connections to this backend.
Setting this will enable SSL for the connection as a side effect.

**Parameters**

- `max`: `TLSVersion`

**Returns**

`*BackendOptions`

### SSLMinVersion

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L297

```go
func (b *BackendOptions) SSLMinVersion(min TLSVersion) *BackendOptions
```

SSLMinVersion sets the minimum allowed TLS version on SSL connections to this backend.
Setting this will enable SSL for the connection as a side effect.

**Parameters**

- `min`: `TLSVersion`

**Returns**

`*BackendOptions`

### TCPKeepaliveEnable

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L399

```go
func (b *BackendOptions) TCPKeepaliveEnable(enable bool) *BackendOptions
```

TCPKeepaliveEnable sets whether or not to use TCP keepalives to try to
maintain the connetion to the backend.

**Parameters**

- `enable`: `bool`

**Returns**

`*BackendOptions`

### TCPKeepaliveInterval

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L410

```go
func (b *BackendOptions) TCPKeepaliveInterval(interval time.Duration) *BackendOptions
```

TCPKeepaliveInterval sets the interval to use when sending TCP keepalive
probes. Intervals of less than 1 second will be rounded up to 1 second.

Setting this value implicitly enables TCP keepalives. If you are calling both
this method and `TCPKeepAliveEnable` with dynamically loaded or generated
values, make sure to call `TCPKeepAliveEnable` last.

**Parameters**

- `interval`: `time.Duration`

**Returns**

`*BackendOptions`

### TCPKeepaliveProbes

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L421

```go
func (b *BackendOptions) TCPKeepaliveProbes(count uint32) *BackendOptions
```

TCPKeepaliveProbes sets how many unanswered TCP probes we should send to the
backend before we consider the connection dead. Setting this value
implicitly enables TCP keepalives.

**Parameters**

- `count`: `uint32`

**Returns**

`*BackendOptions`

### TCPKeepaliveTime

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L429

```go
func (b *BackendOptions) TCPKeepaliveTime(interval time.Duration) *BackendOptions
```

TCPKeepaliveTime sets how long to wait after the last data was sent before
starting to send keepalive probes. Setting this value implicitly enables
TCP keepalives.

**Parameters**

- `interval`: `time.Duration`

**Returns**

`*BackendOptions`

### UseGRPC

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L439

```go
func (b *BackendOptions) UseGRPC(v bool) *BackendOptions
```

UseGRPC sets whether or not to connect to the backend via gRPC

**Parameters**

- `v`: `bool`

**Returns**

`*BackendOptions`

### UseSSL

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/backend.go#L290

```go
func (b *BackendOptions) UseSSL(v bool) *BackendOptions
```

UseSSL sets whether or not to require TLS for connections to this backend.

When using TLS, Fastly checks the validity of the backend's certificate, and fails the connection if the certificate is invalid.
This check is not optional: an invalid certificate will cause the backend connection to fail (but read on).

By default, the validity check does not require that the certificate hostname matches the hostname of your request.
You can use [BackendOptions.CertHostname](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/struct.BackendOptions/#method-CertHostname) to request a check of the certificate hostname.

By default, certificate validity uses a set of public certificate authorities.
You can specify an alternative CA using [BackendOptions.CACert](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/struct.BackendOptions/#method-CACert).

**Parameters**

- `v`: `bool`

**Returns**

`*BackendOptions`
