Troubleshooting service router

We are in the process of deploying an 3 tear application with a frontend , backend and database services.
We have a nomad job which deploys the backend and the database and then a frontend job which handles the frontend. All these are using consul connect and the frontend has http port exposed .
I created a service router definition that uses a HTTP match rule that routes the remix “/” to the frontend app (this works) and the prefix “/api/” to the backend service that hosts this feature.
The normal root URL is going to the frontend correctly but the routing is not working and its not being redirected. An error of the http engine with a 404 is presented.
How can I debug the service router to see what is wrong ??

Having the same problem here. Were you able to find a solution?

HI @carlosrbcunha,

The Consul UI provides a way to view the routing configuration for a given service by clicking the Routing tab under the service details. For example:

This will allow you to easily verify whether the paths are appropriately configured to route to the correct backend services.

Assuming the configuration is correct, the next step would be to verify whether the the requests are reaching the backend. Take a look at the logs for your applications to see whether the request is being received, and whether the URL path matches what is required by the application.

Lastly, you can configure the Envoy sidecar to emit additional debugging logs. You may do this by logging into the allocation for the sidecar and issuing the following curl command against Envoy’s admin API interface to increase the HTTP filter’s logging output level to debug (you may need to install curl if not present in the image).

curl --request POST http://localhost:19000/logging?http=debug

The additional logs should be visible when viewing the log output from this running allocation.

I hope this info is helpful. Let me know if you have any additional questions.

1 Like