bcgov / gwa-api

Gateway Admin API for self-service of Kong configuration, ACL management and BCDC Catalog updates for API metadata
Apache License 2.0
6 stars 4 forks source link

Service status endpoint not returning correct status #96

Open chrsamp opened 1 year ago

chrsamp commented 1 year ago

When configuring a service that also uses the request-transformer plugin to rewrite the Host header to the upstream service, the GET /v2/namespaces/{ns}/services endpoint shows the service as down, when in fact both the upstream and APS service are operating normally.

gwconfig.yaml

services:
- name: aps-docs
  host: bcgov.github.io
  path: /aps-infra-platform/
  tags: [ ns.csampson ]
  plugins:
  - config:
      add:
        headers:
          - "Host: bcgov.github.io"
    enabled: true
    name: request-transformer
    protocols:
    - https
    - http
    tags: [ ns.csampson ]
  port: 443
  protocol: https
  retries: 0
  routes:
  - name: aps-docs-route
    tags: [ ns.csampson ]
    hosts:
    - aps-docs.api.gov.bc.ca
    preserve_host: false
    paths:
    - /
    methods:
    - GET
    strip_path: false
    https_redirect_status_code: 426
    path_handling: v0
    request_buffering: true
    response_buffering: true

gwa-api Response

[
    {
        "env_host": "aps-docs.api.gov.bc.ca",
        "host": "aps-docs.api.gov.bc.ca",
        "name": "aps-docs",
        "reason": "404 Response",
        "status": "DOWN",
        "upstream": "https://bcgov.github.io:443/aps-infra-platform/"
    }
]

Expected behaviour

The GET /v2/namespaces/{ns}/services endpoint shows the service as up

Observed behaviour

The GET /v2/namespaces/{ns}/services endpoint erroneously responds with a "404 Down" response (in this case, because the upstream returns 404 for unknown hosts).

curl https://aps-docs.api.gov.bc.ca returns an HTTP 200 code and the correct response from the upstream service.

JohnathanBrammall commented 1 year ago

Confirm if this has been resolved with latest deployment.