Skip to content

Proxy

The proxy component allows daiquiri to proxy requests from other services adding authentication and authorization.

It can be configured as follows:

component: proxy
#A list of services to proxy
proxies:
  # Name of the proxy: /api/proxy/myservice
- name: myservice
  # URL of the service to proxy
  target: http://localhost/url
  # openapi spec of the service
  openapi: http://localhost/openapi.json
  # Routes to proxy
  # If not provided, all routes from openapi spec are available
  routes:
      # Proxy http://localhost/url/sub as /api/proxy/myservice/sub
    - name: sub
      # Methods to expose (optional, default: get)
      methods: [get, post]
      # Can pass extra headers
      headers:
        Authorization: Bearer <token>
    # Url mappings can also contain url parameters:
    # Proxy http://localhost/url/sub/<int:param> as /api/proxy/myservice/sub/<int:param>
    - name: sub/<int:param>
    # methods and headers are optional

OpenAPI location

The OpenAPI have to be reachable.

It can be defined from a Daiquiri resource with a prefix res://, or from as file from the file system with a prefix file://.

Optionally it can be defined from http or https for example pointing to the OpenAPI file generated by the real service. It can be used for testing but it is not recommended, because if the service is not online, Daiquiri will not be able to setup the proxy.