We are trying to call an external service which is outside of K8s cluster through Tyk ingress which is created through tyk-operator. For this we have created a Service of type ExternalName.
apiVersion: v1 kind: Service metadata: name: external-service namespace: tyk spec: type: ExternalName externalName: httpbin.org ports: - port: 80
This service we have referred it in the Ingress -
apiVersion: tyk.tyk.io/v1alpha1 kind: ApiDefinition metadata: name: httpbin-ingress-template labels: template: "true" spec: name: tyk protocol: http active: true use_keyless: true proxy: target_url: http://httpbin.org listen_path: /v1/httpbin-ingress-api strip_listen_path: true version_data: default_version: Default not_versioned: true versions: Default: use_extended_paths: true name: Default global_headers: Host: "httpbin.org" uuid: "random" --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: httpbin-ingress annotations: kubernetes.io/ingress.class: tyk tyk.io/template: httpbin-ingress-template spec: rules: - http: paths: - path: /v1/httpbin-ingress-api pathType: Prefix backend: service: name: external-service port: number: 80
When I call this API it is calling the ExternalName service properly but the call is failing because Host header is not set to “httpbin.org”.
I tried setting the Host header in global_headers in ApiDefinition but looks like it is not getting set. Other headers are getting set properly but the Host header.
Is there anything which I am missing here?