Skip to content

Upstream Authentication

Inject Upstream Header

Inject Upstream Header. This is useful if e.g. a static api key must provided that is not available by the client. Upstream Authentication can be easily configured using the Upstream Authentication configuration.

OpenAPI Specification
info:
  title: Inject Upstream Header
openapi: 3.0.3
paths:
  /test:
    get:
      responses:
        '200':
          description: OK
servers:
  - url: http://127.0.0.1:/api/echo
x-proxyconf:
  cluster: demo
  security:
    auth:
      downstream: disabled
      upstream:
        name: upstream-api-key
        overwrite: false
        type: header
        value: upstream-secret
  url: http://localhost:8080/inject-upstream-header

HURL Examples

POST http://localhost:{{port}}/api/upload/inject-upstream-header?api-port={{port}}&envoy-cluster={{envoy-cluster}}
Content-Type: application/yaml
Authorization: Bearer {{admin-access-token}}
file,inject-upstream-header.yaml;
HTTP 200


# If the client does not provides the header, it is set
GET http://localhost:8080/inject-upstream-header/test
HTTP 200
Content-Type: application/json
[Asserts]
jsonpath "$.headers.upstream-api-key" == "upstream-secret"


# If the client provides the header, it is passed through
GET http://localhost:8080/inject-upstream-header/test
upstream-api-key: override-upstream-secret
HTTP 200
Content-Type: application/json
[Asserts]
jsonpath "$.headers.upstream-api-key" == "override-upstream-secret"