【问题标题】:IBM API Connect: Set-Variable does not workIBM API Connect:Set-Variable 不起作用
【发布时间】:2022-11-27 11:31:12
【问题描述】:

我是 IBM API Connect 的新手。我想要实现的是将 API 调用方和 IBM API Connect 之间相互 TLS 连接中使用的客户端证书作为 Client-Cert HTTP 标头的值传递给后端服务器。

我认为Set-Variable 可以用于此目的,但转发到后端服务器的请求不包含 Client-Cert HTTP 标头。

谁能帮帮我?

swagger: '2.0'
info:
  version: 1.0.0
  title: test
  x-ibm-name: test
basePath: /test
x-ibm-configuration:
  properties:
    target-url:
      value: https://httpdump.io/tqvg_
      description: URL of the proxy policy
      encoded: false
  cors:
    enabled: true
  gateway: datapower-api-gateway
  type: rest
  phase: realized
  enforced: true
  testable: true
  assembly:
    execute:
      - set-variable:
          version: 2.0.0
          title: client-cert
          actions:
            - value: ':$(application.certificate.Base64):'
              type: string
              add: Client-Cert
            - value: My-Value
              add: My-Header
              type: string
          description: >-
            Set the client certificate used in the mutual TLS connection to the
            Client-Cert HTTP header in the format defined in "Client-Cert HTTP
            Header Field".
      - invoke:
          version: 2.2.0
          title: invoke
          backend-type: detect
          header-control:
            type: blocklist
            values: []
          parameter-control:
            type: blocklist
            values: []
          http-version: HTTP/1.1
          timeout: 60
          verb: POST
          chunked-uploads: true
          persistent-connection: true
          cache-response: protocol
          cache-ttl: 900
          stop-on-error: []
          websocket-upgrade: false
          target-url: $(target-url)
          graphql-send-type: detect
    finally: []
  activity-log:
    enabled: true
    success-content: activity
    error-content: payload
paths:
  /:
    get:
      responses:
        '200':
          description: success
          schema:
            type: string
      consumes: []
      produces: []
    put:
      responses:
        '200':
          description: success
          schema:
            type: string
      consumes: []
      produces: []
    post:
      responses:
        '200':
          description: success
          schema:
            type: string
      consumes: []
      produces: []
    delete:
      responses:
        '200':
          description: success
          schema:
            type: string
      consumes: []
      produces: []
    head:
      responses:
        '200':
          description: success
          schema:
            type: string
      consumes: []
      produces: []
    patch:
      responses:
        '200':
          description: success
          schema:
            type: string
      consumes: []
      produces: []
schemes:
  - https

【问题讨论】:

    标签: ibm-api-connect


    【解决方案1】:

    如果你想添加一个标题,你的变量名应该是 message.headers.Client-Cert。否则,您只是在创建一个永远不会被读取的内部变量。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-29
      • 2013-09-10
      • 1970-01-01
      • 2021-01-31
      • 2016-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多