Tyk on-premise Ubunutu - 404 on API's

I have gone through the on-premise install process word for word and I have created an api test-api. However all curl’s to this return 404. However the test api does work.

curl -H “Authorization: null” http://localhost:8080/test-api/ip
404 page not found

curl -H “Authorization: null” http://localhost:8080/tyk-api-test/ip
{
“error”: “Key not authorised”
}

I have remove and re-added with multiple variation and restarted all services pump, gateway and dashboard with no luck. I have also looked at the upstart logs, syslog and anywhere else to try and find any errors, but can’t find anything.

Any suggesitons?

Can your provide the gateway logs? It looks like the gateway hasn’t loaded your APIs

Hi Martin

I have the same issue having just installed the on-prem version of Tyk following the install guide for Ubuntu.

I have setup the dashboard to use a custom domain api.mysite.com which could be the reason but I am not sure why as I cant find any specific config in the gateway for my custom domain.

I have tried:
Restarting the host
Restarting the tyk-dashboard, tyk-pump and tyk-gateway
Changing “enable_custom_domains”: false and then true in tyk.conf

None of these changes worked but I can see that the API’s did load

Reproduction steps:

Log on dashboard
Go to API’s
Create “test-api” api definiton
Set keyless for Authentication mode
Save
Open api url(in my case http://localhost:8080/test1

Result

  1. Gateway returns 404 error
  2. As expected, if I stop the gateway the browser returns a “This site can’t be reached SERVERNAME refused to connect.”
  3. I can see the from the Gateway logs that the API config has been loaded but the invoking the target API does not make an entry in the gateway logs

Gateway logs are as follows:
[Mar 11 14:37:18] INFO main: Setting up analytics normaliser
[Mar 11 14:37:18] INFO main: PIDFile location set to: ./tyk-gateway.pid
[Mar 11 14:37:18] INFO main: Initialising Tyk REST API Endpoints
[Mar 11 14:37:18] INFO host-check-mgr: Starting Poller
[Mar 11 14:37:18] INFO Redis connection pools are ready after number of retires currRetry=0
[Mar 11 14:37:18] INFO Redis connection pools are ready
[Mar 11 14:37:18] INFO main: → Standard listener (http) port=:8080
[Mar 11 14:37:18] INFO main: Initialising distributed rate limiter
[Mar 11 14:37:18] INFO main: Setting up Server
[Mar 11 14:37:18] INFO main: Waiting for zeroconf signal…
[Mar 11 14:37:18] INFO Starting gateway rate limiter notifications…
[Mar 11 14:37:19] WARN pub-sub: Insecure configuration detected (allowing)!
[Mar 11 14:37:19] INFO pub-sub: Hostname set with dashboard zeroconf signal
[Mar 11 14:37:19] INFO main: Registering node.
[Mar 11 14:37:19] INFO dashboard: Node registered id=fdf8cbfc-3115-45c7-7861-2ae10a3e0f20
[Mar 11 14:37:19] INFO main: Gateway started (v2.5.3)
[Mar 11 14:37:19] INFO main: → Listening on address: (open interface)
[Mar 11 14:37:19] INFO main: → Listening on port: 8080
[Mar 11 14:37:19] INFO main: → PID: 4441
[Mar 11 14:37:19] INFO main: Loading policies
[Mar 11 14:37:19] INFO main: Using Policies from Dashboard Service
[Mar 11 14:37:19] INFO policy: Mutex lock acquired… calling
[Mar 11 14:37:19] INFO policy: Calling dashboard service for policy list
[Mar 11 14:37:19] INFO policy: Processing policy list
[Mar 11 14:37:19] INFO main: Policies found (0 total):
[Mar 11 14:37:19] INFO main: Detected 3 APIs
[Mar 11 14:37:19] INFO main: Preparing new router
[Mar 11 14:37:19] INFO main: Initialising Tyk REST API Endpoints
[Mar 11 14:37:19] INFO main: Loading API configurations.
[Mar 11 14:37:19] INFO main: Tracking hostname api_name=httpbin domain=(no host)
[Mar 11 14:37:19] INFO main: Tracking hostname api_name=test1 domain=(no host)
[Mar 11 14:37:19] INFO main: Tracking hostname api_name=test2 domain=(no host)
[Mar 11 14:37:19] INFO main: Loading API api_name=httpbin
[Mar 11 14:37:19] INFO main: Loading API api_name=test1
[Mar 11 14:37:19] INFO main: Loading API api_name=test2
[Mar 11 14:37:19] INFO main: Checking security policy: Open api_name=httpbin
[Mar 11 14:37:19] INFO gateway: Loaded: httpbin api_id=80482d80d15c4d646b7f3e5ee047172e org_id=5aa4e41461451e77ccb74257 server_name=-- user_id=-- user_ip=–
[Mar 11 14:37:19] INFO main: Checking security policy: Open api_name=test1
[Mar 11 14:37:19] INFO gateway: Loaded: test1 api_id=c5f94d7b6541449970357e21d9d5ccd5 org_id=5aa4e41461451e77ccb74257 server_name=-- user_id=-- user_ip=–
[Mar 11 14:37:19] INFO main: Checking security policy: Open api_name=test2
[Mar 11 14:37:19] INFO gateway: Loaded: test2 api_id=4f1747a9ee2344bf7532973df339db4a org_id=5aa4e41461451e77ccb74257 server_name=-- user_id=-- user_ip=–
[Mar 11 14:37:19] INFO main: Processed and listening on: /httpbin/{rest:.}
[Mar 11 14:37:19] INFO main: Processed and listening on: /test1/{rest:.
}
[Mar 11 14:37:19] INFO main: Processed and listening on: /test2/{rest:.*}
[Mar 11 14:37:19] INFO host-check-mgr: Loading uptime tests…
[Mar 11 14:37:19] INFO main: Initialised API Definitions
[Mar 11 14:37:19] INFO main: API reload complete

/opt/tyk-gateway$ cat tyk.conf
{
“listen_port”: 8080,
“node_secret”: “352d20ee67be67f6340b4c0605b044b7”,
“secret”: “352d20ee67be67f6340b4c0605b044b7”,
“template_path”: “/opt/tyk-gateway/templates”,
“use_db_app_configs”: true,
“db_app_conf_options”: {
“connection_string”: “”,
“node_is_segmented”: false,
“tags”: []
},
“disable_dashboard_zeroconf”: false,
“app_path”: “/opt/tyk-gateway/apps”,
“middleware_path”: “/opt/tyk-gateway/middleware”,
“storage”: {
“type”: “redis”,
“host”: “localhost”,
“port”: 6379,
“username”: “”,
“password”: “”,
“database”: 0,
“optimisation_max_idle”: 2000,
“optimisation_max_active”: 4000
},
“enable_analytics”: true,
“analytics_config”: {
“type”: “”,
“ignored_ips”: [],
“enable_detailed_recording”: true,
“enable_geo_ip”: false,
“geo_ip_db_path”: “”,
“normalise_urls”: {
“enabled”: true,
“normalise_uuids”: true,
“normalise_numbers”: true,
“custom_patterns”: []
}
},
“health_check”: {
“enable_health_checks”: false,
“health_check_value_timeouts”: 60
},
“optimisations_use_async_session_write”: true,
“allow_master_keys”: false,
“policies”: {
“policy_source”: “service”,
“policy_connection_string”: “”,
“policy_record_name”: “tyk_policies”,
“allow_explicit_policy_id”: true
},
“hash_keys”: true,
“suppress_redis_signal_reload”: false,
“use_redis_log”: true,
“close_connections”: true,
“enable_non_transactional_rate_limiter”: true,
“enable_sentinel_rate_limiter”: false,
“local_session_cache”: {
“disable_cached_session_state”: false
},
“http_server_options”: {
“enable_websockets”: true
},
“uptime_tests”: {
“disable”: false,
“config”: {
“enable_uptime_analytics”: true,
“failure_trigger_sample_size”: 2,
“time_wait”: 10,
“checker_pool_size”: 50
}
},
“hostname”: “”,
“enable_custom_domains”: false,
“enable_jsvm”: true,
“oauth_redirect_uri_separator”: “;”,
“coprocess_options”: {
“enable_coprocess”: false,
“coprocess_grpc_server”: “”
},
“pid_file_location”: “./tyk-gateway.pid”,
“allow_insecure_configs”: true,
“public_key_path”: “”,
“close_idle_connections”: false,
“allow_remote_config”: false,
“enable_bundle_downloader”: true,
“bundle_base_url”: “”,
“global_session_lifetime”: 100,
“force_global_session_lifetime”: false,
“max_idle_connections_per_host”: 100
}

Many thanks,
Marcus

Hi

i just created a post with same issue