1.1.9. Forward

The Request object has two readonly properties related to forwarding. $xForwarded

The $xForwarded property is an instance of Sapien\Request\Header\XForwarded.

The XForwarded object has these readonly properties:

  • array $for: An array computed from treating $header['x-forwarded-for'] as comma-separated values.

  • ?string $host: The $headers['x-forwarded-host'] value, if any.

  • ?int $port: The $headers['x-forwarded-port'] value, if any.

  • ?string $prefix: The $headers['x-forwarded-prefix'] value, if any.

  • ?string $proto: The $headers['x-forwarded-proto'] value, if any. $forwarded

The $forwarded property is a readonly ValueCollection of Sapien\Request\Header\Forwarded objects.

Each Forwarded object has the following readonly properties computed from the $headers['forwarded'] element:

  • ?string $by: The interface where the request came in to the proxy server.

  • ?string $for: Discloses information about the client that initiated the request.

  • ?string $host: The original value of the Host header field.

  • ?string $proto: The value of the used protocol type.


Cf. the Forwarded HTTP Extension.