Tyk is not adding http protocol

0

I’m connecting Tyk gateway with Consul to obtain IPs of services. Services register automatically on Consul (spring boot projects). Tyk is not adding http infront of the IP or name or hosts. I tried everything like using “scheme” and “target_url” etc in Tyk configuration

When I send Tyk a request like this: curl --location 'http://tyk:8080/consumer/consume' --header 'x-tyk-authorization: SOME_SECRET' --header 'x-api-version: Default'

This is the error that Tyk throws:

tyk-container       | time="Aug 27 11:40:54" level=error msg="http: proxy error: unsupported protocol scheme """ api_id=consumer api_name="Consumer Api" mw=ReverseProxy org_id=1 prefix=proxy server_name= user_id=-- user_ip=192.168.50.1 user_name=
tyk-container       | time="Aug 27 11:40:54" level=error msg="[PROXY] [LOAD BALANCING] Couldn't parse target URL:parse "192.168.50.11:8080": first path segment in URL cannot contain colon"

And this is my Tyk configuration file:

{
  "name": "Consumer Api",
  "slug": "consumer",
  "api_id": "consumer",
  "use_keyless": true,
  "org_id": "1",
  
  "version_data": {
    "not_versioned": true,
    "versions": {
      "Default": {
        "name": "Default",
        "use_extended_paths": true
      }
    }
  },
  
  "proxy": {
    "listen_path": "/consumer",
    "strip_listen_path": true,
    
    "use_service_discovery": true,
      "service_discovery": {
        "use_discovery_service": true,
        "query_endpoint": "http://192.168.50.2:8500/v1/catalog/service/consumer",
        "cache_timeout": 30,
        "use_nested_query": false,
        "parent_data_path": "",
        "data_path": "ServiceAddress",
        "port_data_path": "ServicePort",
        "endpoint_returns_list": true,
        "use_target_list": false
      }

  },

  "active": true
}

Just in case, this is an example of what Consul is returning when I issue this request: http://localhost:8500/v1/catalog/service/consumer

[
   {
      "ID":"7e8fff41-f3dd-ca77-a46e-8f37f6cba911",
      "Node":"9ef7fef457ab",
      "Address":"192.168.50.2",
      "Datacenter":"dc1",
      "TaggedAddresses":{
         "lan":"192.168.50.2",
         "lan_ipv4":"192.168.50.2",
         "wan":"192.168.50.2",
         "wan_ipv4":"192.168.50.2"
      },
      "NodeMeta":{
         "consul-network-segment":""
      },
      "ServiceKind":"",
      "ServiceID":"consumer-54b9e3f766d99ecdb03bc537506f9cff",
      "ServiceName":"consumer",
      "ServiceTags":[
         
      ],
      "ServiceAddress":"e2d03c108178",
      "ServiceWeights":{
         "Passing":1,
         "Warning":1
      },
      "ServiceMeta":{
         "secure":"false"
      },
      "ServicePort":8080,
      "ServiceSocketPath":"",
      "ServiceEnableTagOverride":false,
      "ServiceProxy":{
         "Mode":"",
         "MeshGateway":{
            
         },
         "Expose":{
            
         }
      },
      "ServiceConnect":{
         
      },
      "CreateIndex":30,
      "ModifyIndex":30
   }
]

Hi @jlseminara,

Welcome to the community :partying_face:
This is a known issue, and it’s been fixed starting with version v5.3.2.

OMG so sorry about that and thank you for your answer. Problem is that I’m using this image

image

and thought that the word “latest” would do the trick