Nginx 404 Error [SOLVED]

I have had a very strange error setting up TYK.

Incoming requests are handled by NGINX listening on port 80

The base config for NGINX contains:

 # Enumerate all the Tyk servers here
   upstream tyk {
   upstream dashboard {

There are 3 subdomains for portal, gateway and dashboard that run a proxy pass to the servers above. They will do:

   location / {
       #rewrite /(.*) /[API_LISTEN_PATH]/$1 break;
       proxy_pass_header Server;
       proxy_set_header Host $http_host;
       proxy_redirect off;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Scheme $scheme;
       proxy_pass http://dashboard;

If I enter:

I get a 404 not found error

Displays the dashboard the page.

I setup the dashboard using:

sudo /opt/tyk-dashboard/install/ --listenport=3000 --redishost=localhost --redisport=6379 --mongo=mongodb:// --tyk_api_hostname="" --tyk_node_hostname=http://localhost --tyk_node_port=8080 --portal_root=/portal --domain=""

I setup the gateway with:

sudo /opt/tyk-gateway/install/ --dashboard=1 --listenport=8080 --redishost=localhost --redisport=6379 --domain="" --mongo=mongodb://

I have tried any number of combinations to try and get this working but I am at a total loss now and chasing my tail so I thought I would see if there was anyone who could help me find my mistake



If you are using NGinX, then I’d switch off the hostname handling in Tyk and dashboard completely (enable_host_names:false IIRC in tyk_analytics.conf)

If tyk dashboard is binding to a domain it’s very strict, and it includes the port number in its matching - NGinX will be forwarding the hostname without the port number so Tyk won’t match properly.

In one fell swoop Martin solves a nagging problem and causes me to lose a bet re: cheesecake for dessert.

Thanks Martin. Really great software, looking forward to giving it gears.


1 Like