Tyk On-premises setup


#1

Hi All,
I have configured tyk on-premises and created a new api for testing but when i hit the api url on browser it says This site can’t be reached.
curl command says connection refused.

here is the RAW API DEFINITION:

{
“api_model”: {},
“api_definition”: {
“api_id”: “d0e0c9588ada4cd571af93f5239758f2”,
“jwt_issued_at_validation_skew”: 0,
“upstream_certificates”: {},
“use_keyless”: true,
“enable_coprocess_auth”: false,
“custom_middleware”: {
“pre”: [],
“post”: [],
“post_key_auth”: [],
“auth_check”: {
“name”: “”,
“path”: “”,
“require_session”: false
},
“response”: [],
“driver”: “”,
“id_extractor”: {
“extract_from”: “”,
“extract_with”: “”,
“extractor_config”: {}
}
},
“disable_quota”: true,
“custom_middleware_bundle”: “”,
“cache_options”: {
“cache_timeout”: 60,
“enable_cache”: true,
“cache_all_safe_requests”: false,
“cache_response_codes”: [],
“enable_upstream_cache_control”: false,
“cache_control_ttl_header”: “”
},
“enable_ip_blacklisting”: false,
“tag_headers”: [],
“pinned_public_keys”: {},
“expire_analytics_after”: 0,
“domain”: “localhost”,
“openid_options”: {
“providers”: [],
“segregate_by_client”: false
},
“active”: true,
“jwt_expires_at_validation_skew”: 0,
“config_data”: {},
“notifications”: {
“shared_secret”: “”,
“oauth_on_keychange_url”: “”
},
“auth”: {
“auth_header_name”: “”,
“use_certificate”: false
},
“check_host_against_uptime_tests”: false,
“auth_provider”: {
“name”: “”,
“storage_engine”: “”,
“meta”: {}
},
“blacklisted_ips”: [],
“hmac_allowed_clock_skew”: -1,
“dont_set_quota_on_create”: false,
“uptime_tests”: {
“check_list”: [],
“config”: {
“expire_utime_after”: 0,
“service_discovery”: {
“use_discovery_service”: false,
“query_endpoint”: “”,
“use_nested_query”: false,
“parent_data_path”: “”,
“data_path”: “”,
“cache_timeout”: 60
},
“recheck_wait”: 0
}
},
“enable_jwt”: false,
“do_not_track”: false,
“name”: “ekart”,
“slug”: “ekart”,
“oauth_meta”: {
“allowed_access_types”: [],
“allowed_authorize_types”: [],
“auth_login_redirect”: “”
},
“CORS”: {
“enable”: true,
“max_age”: 24,
“allow_credentials”: true,
“exposed_headers”: [],
“allowed_headers”: [],
“options_passthrough”: true,
“debug”: false,
“allowed_origins”: [],
“allowed_methods”: []
},
“event_handlers”: {
“events”: {}
},
“proxy”: {
“target_url”: “”,
“endpoint_returns_list”: false,
“cache_timeout”: 0,
“parent_data_path”: “”,
“service_discovery”: {
“endpoint_returns_list”: false,
“cache_timeout”: 0,
“parent_data_path”: “”,
“query_endpoint”: “”,
“use_discovery_service”: false,
“target_path”: “”,
“use_target_list”: false,
“use_nested_query”: false,
“data_path”: “”,
“port_data_path”: “”
},
“check_host_against_uptime_tests”: false,
“transport”: {
“ssl_ciphers”: [],
“ssl_min_version”: 0,
“proxy_url”: “”
},
“target_list”: [],
“query_endpoint”: “”,
“use_discovery_service”: false,
“_sd_show_port_path”: false,
“preserve_host_header”: false,
“use_target_list”: false,
“strip_listen_path”: false,
“use_nested_query”: false,
“data_path”: “”,
“port_data_path”: “”,
“enable_load_balancing”: true,
“listen_path”: “/ekart/”,
“disable_strip_slash”: false
},
“client_certificates”: [],
“use_basic_auth”: false,
“version_data”: {
“not_versioned”: true,
“default_version”: “”,
“versions”: {
“Default”: {
“name”: “Default”,
“expires”: “”,
“paths”: {
“ignored”: [],
“white_list”: [],
“black_list”: []
},
“use_extended_paths”: true,
“extended_paths”: {
“ignored”: [],
“white_list”: [],
“black_list”: [],
“transform”: [],
“transform_response”: [],
“transform_jq”: [],
“transform_jq_response”: [],
“transform_headers”: [],
“transform_response_headers”: [],
“hard_timeouts”: [],
“circuit_breakers”: [],
“url_rewrites”: [],
“virtual”: [],
“size_limits”: [],
“method_transforms”: [],
“track_endpoints”: [],
“do_not_track_endpoints”: [],
“validate_json”: []
},
“global_headers”: {},
“global_headers_remove”: [],
“global_size_limit”: 0,
“override_target”: “”
}
}
},
“use_standard_auth”: false,
“session_lifetime”: 0,
“hmac_allowed_algorithms”: [],
“disable_rate_limit”: true,
“definition”: {
“location”: “header”,
“key”: “x-api-version”,
“strip_path”: false
},
“use_oauth2”: false,
“jwt_not_before_validation_skew”: 0,
“allowed_ips”: [],
“org_id”: “5c777567f86ef8760c7d5fdb”,
“enable_ip_whitelisting”: false,
“global_rate_limit”: {
“rate”: 0,
“per”: 0
},
“enable_context_vars”: false,
“tags”: [],
“basic_auth”: {
“disable_caching”: false,
“cache_ttl”: 0
},
“session_provider”: {
“name”: “”,
“storage_engine”: “”,
“meta”: {}
},
“strip_auth_data”: true,
“id”: “5c777b3df86ef8760c7d5fdc”,
“certificates”: [],
“enable_signature_checking”: false,
“use_openid”: false,
“jwt_skip_kid”: false,
“enable_batch_request_support”: false,
“response_processors”: [],
“use_mutual_tls_auth”: false
},
“hook_references”: [],
“is_site”: false,
“sort_by”: 0
}

Blockquote

Blockquote


#2

Connection refused errors probably do not have their origin in the API definition, but in the server itself (API definition would cause HTTP4xx or HTTP5xx errors usually). Are you sure you configured the server to listen on the interface you are hitting with your browser? Is the server even running?


#3

Hi beyerj,

Are you talking about the api server(backend)? if yes. i am trying to hit “http://httpbin.org”.
Or do i need to start a separate server for tyk itself?


#4

I am talking about tyk itself. It is a service. You need to start it somehow (manually or automatically). See for example:

https://tyk.io/docs/get-started/with-tyk-on-premise/installation/on-ubuntu/

If you follow through to your application (probably gateway) it has a part about the setup helper commands, which set up the service.

As explanation:
Connection refused is a low-level network error, stating that the server actively refused connections on this port. So, the most common issue would be: You are connecting to the wrong port, or your service is not configured to the correct port, or - and that’s what I was talking about - your service is configured to the correct port, you are connecting to the correct port, but the service is not running at all. API configuration errors should not result in Connection refused errors, but in File not found (HTTP404) and similar errors.