target

Version

Defines the backend a proxy forwards messages to, given either as a host with a port or as a full url. The destination can be computed per request with inline ${expression} templates; outbound TLS and an overriding HTTP method can also be configured here.

Example Configuration

target:
url: https://api.predic8.de
target:
   url: https://api.predic8.de

Syntax

target:
'$ref': <string>
adjustHostHeader: <boolean>
escaping: json
host: <string>
language: groovy
method: <string>
port: <int>
ssl: {}
url: <string>
xmlConfig: {}
target:
  '$ref': <string>
  adjustHostHeader: <boolean>
  escaping: json
  host: <string>
  language: groovy
  method: <string>
  port: <int>
  ssl: {}
  url: <string>
  xmlConfig: {}

Attributes

NameRequiredDefaultDescriptionExamples
$reffalse-Reference a component defined under components.-
adjustHostHeaderfalsetrueRewrites the outgoing Host header to the target host. Disable to forward the client's original Host header unchanged.false
escapingfalseURLHow values computed from ${...} templates are escaped before being inserted into the URL, to prevent injection. URL escapes a whole URL, SEGMENT a single path segment, NONE disables escaping.SEGMENT
hostfalse-Host name or IP address of the target. Ignored when url is set.localhost
languagefalseSpELExpression language used to evaluate inline ${...} templates in the URL.groovy
methodfalse-Overrides the HTTP method used for the backend call, replacing the method of the incoming request. When not set, the original method is kept.POST
portfalse80, or 443 when the target uses TLSPort number of the target. Ignored when url is set.8080
urlfalse-Absolute URL of the target. When set, host and port are ignored. Supports inline ${<expression>} templates. If the URL contains a path, that path replaces the request path; usually the request path should be kept, so give a URL without a path such as https://api.predic8.de.https://api.predic8.de

Child Structure

ElementCardinalityDescription
ssl0..1Configures a TLS context: the identity (key and certificate) presented to the peer, the certificates trusted from it, and handshake parameters such as protocol, ciphers, and client-certificate policy. Attach it to a serviceProxy/api to terminate inbound TLS, or to a target to make an outbound connection over TLS; most attributes and child elements apply to both directions, but a few - such as clientAuth and useAsDefault - only take effect on an inbound context. See tutorials/ssl-tls/10-TLS-Termination.yaml for inbound termination and tutorials/ssl-tls/20-Central-SSL-Config.yaml for sharing one ssl across several APIs via $ref.
xmlConfig0..1

Can be used in