Tyk Service discovery - Request headers to Consul

We currently have Consul as our discovery service and are trying to get Tyk to talk to Consul for discovery of upstream services. Consul expects a header “X-Consul-Token” in the request. Is there a way to pass it in the Tyk API configuration JSON? Below is the service discovery part of the JSON:

“service_discovery”: {
use_discovery_service: true,
query_endpoint: “https://consul-host/v1/catalog/service/myService”,
use_nested_query: true,
parent_data_path: “”,
data_path: “Address”,
port_data_path: “ServicePort”,
use_target_list: true,
cache_timeout: 10,
target_path: “”
}

Thanks and Regards,
Sagar

I’m afraid currently it is not possible. Right now functionality is pretty basic, and just doing http GET request. https://github.com/TykTechnologies/tyk/blob/master/service_discovery.go#L49

I know that consul support passing token via URL query param, so I would recommend this solution.

Hope it helps.

Thanks Leon, that works for now, though we need to see the security implications.

In continuation to the above question, once Tyk gets the endpoint details of an upstream service from Consul, the call to the upstream service is made with HTTP protocol while the service expects HTTPS with a specific header. I could not find any configurations in the service discovery documentation related to this. Am I missing something?

Thanks and Regards,
Sagar