1. Proxies and Flow

api

Version

API proxy with several routing options.

Multiple APIs on the same port are discriminated by host, path, or a test expression. Incoming requests are probed from the top API to the bottom. The first API that matches the request will process it.

OpenAPI Support

When openapi children are present, Membrane auto-wires a publisher at /api-docs and an OpenAPI rewriter; see tutorials/getting-started/80-OpenAPI.yaml and tutorials/getting-started/90-OpenAPI-Validation.yaml.

Example Configuration

api:
port: 2000
path:
uri: /orders/{id}
target:
url: https://api.predic8.de/shop/orders/{pathParam.id}
---
api:
port: 2000
path:
uri: /orders/
target:
url: https://api.predic8.de
---
api:
port: 2000
test: header.SOAPAction == 'https://predic8.de/city-service/get'
target:
url: https://api.predic8.de
---
api:
port: 2000
openapi:
- location: openapi/fruitshop-api.yaml
api:
   port: 2000
   path:
      uri: /orders/{id}
   target:
     url: https://api.predic8.de/shop/orders/{pathParam.id}
 ---
 api:
   port: 2000
   path:
     uri: /orders/
   target:
     url: https://api.predic8.de
 ---
 api:
   port: 2000
   test: header.SOAPAction == 'https://predic8.de/city-service/get'
   target:
     url: https://api.predic8.de
 ---
 api:
   port: 2000
   openapi:
     - location: openapi/fruitshop-api.yaml

Syntax

api:
'$ref': <string>
description: <string>
flow:
- <flow>
host: <string>
id: <string>
ip: <string>
language: groovy
method: <string>
name: <string>
openapi:
- <openapi>
path: {}
port: <number>
ssl: {}
target: {}
test: <string>
xmlConfig: {}
api:
  '$ref': <string>
  description: <string>
  flow:
    - <flow>
  host: <string>
  id: <string>
  ip: <string>
  language: groovy
  method: <string>
  name: <string>
  openapi:
    - <openapi>
  path: {}
  port: <number>
  ssl: {}
  target: {}
  test: <string>
  xmlConfig: {}

Attributes

NameRequiredDefaultDescriptionExamples
$reffalse-Reference a component defined under components.-
hostfalsenot setRestricts to requests whose Host header matches one of the given hostnames. Separate multiple hostnames with spaces. The asterisk * matches any number of characters, including zero, for basic globbing.predic8.de *.predic8.de
idfalse---
ipfalsenot setIf present, binds the port only on the specified IP. Useful for hosts with multiple IP addresses.127.0.0.1
languagefalse---
methodfalse*Restricts this proxy to requests whose HTTP method (GET, POST, etc.) matches. The asterisk * matches any method.GET
namefalseBy default, a name will be automatically generated from the target host, port, etc.The name as shown in the Admin Console.-
portfalse80The port Membrane listens on for incoming connections.8080
testfalse---

Child Structure

ElementCardinalityDescription
description0..1
flow0..*
openapi0..*Deploys an API from an OpenAPI document.
path0..1Restricts to requests whose path matches, either by prefix (starts-with) or, when enabled, by regular expression. In a soapProxy, setting a path also rewrites the paths of SOAP requests and the service addresses in the WSDL accordingly.
ssl0..1Configures inbound or outbound SSL connections.
target0..1The backend server that requests are forwarded to after passing through the flow.
xmlConfig0..1

Can be used in

No parent elements.