tilegroxy docs

Description

A CDN, load balancer, or reverse proxy replaces the details of the original request with its own and passes the originals along in headers. Tilegroxy only reads those headers when the request arrives from an address listed in Trusted. Requests from anywhere else use their own connection details and any forwarding headers are ignored.

By default every private, loopback, and link-local address is trusted, which covers a proxy running on the same host or network as tilegroxy. A CDN or load balancer with a public address needs to be added. Setting Trusted replaces the default rather than adding to it, and an empty list trusts nothing.

The client IP is used for rate limiting, analytics, and every log. The host, protocol, port, and path prefix are used to build the URLs in TileJSON documents.

For the X-Forwarded-For header, the right-most address that isn’t itself a trusted proxy is used. Any other For header, such as CF-Connecting-IP or True-Client-IP, must hold a single address.

Never include addresses outside your own infrastructure in Trusted. Anyone sending requests from a trusted address can pick their own IP and get a fresh rate limit allowance on every request. If clients can reach tilegroxy directly from a private network, narrow Trusted to just your proxies.

Example

  • YAML

  • JSON

server:
  forwarded:
    trusted:
      - 10.0.0.0/8
    headers:
      for: CF-Connecting-IP
{
  "server": {
    "forwarded": {
      "trusted": [
        "10.0.0.0/8"
      ],
      "headers": {
        "for": "CF-Connecting-IP"
      }
    }
  }
}

Configuration

Configuration options
Parameter Description Type Required Default

Trusted

IP addresses or CIDR ranges of every CDN, load balancer, and reverse proxy in front of tilegroxy. In Kubernetes this is usually the pod CIDR of your ingress controller

string[]

No

10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, 127.0.0.0/8, fc00::/7, fe80::/10, ::1/128

Headers

The headers trusted proxies put the original request details in

Headers

No

See below

Headers
Parameter Description Type Required Default

For

The header holding the client IP

string

No

X-Forwarded-For

Host

The header holding the host the client requested

string

No

X-Forwarded-Host

Proto

The header holding the protocol the client used, either http or https

string

No

X-Forwarded-Proto

Port

The header holding the port the client connected to, a number from 1 to 65535. Ignored when the host already includes a port

string

No

X-Forwarded-Port

Prefix

The header holding the path the proxy serves tilegroxy under. Must start with / and contain only characters valid in a URL path

string

No

X-Forwarded-Prefix

Environment variables
Configuration Parameter Environment Variable

Headers.For

SERVER_FORWARDED_HEADERS_FOR

Headers.Host

SERVER_FORWARDED_HEADERS_HOST

Headers.Proto

SERVER_FORWARDED_HEADERS_PROTO

Headers.Port

SERVER_FORWARDED_HEADERS_PORT

Headers.Prefix

SERVER_FORWARDED_HEADERS_PREFIX