Accessing application gets 404 error due to invalid B3 trace ID
search cancel

Accessing application gets 404 error due to invalid B3 trace ID

book

Article ID: 298323

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

A 404 response is returned when accessing application with message like below seen in gorouter access logs.
myapp.apps.example.com - [2022-11-10T23:54:46.272238955Z] "GET /index HTTP/1.1" 404 0 0 "https://myaccount.example.com/auth/public/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15" "x.x.x.x:39130" x_forwarded_for:"x.x.x.x" x_forwarded_proto:"https" vcap_request_id:"bdf8249e-54e2-44df-7d85-dc8623d8c9a8" response_time:0.001498 gorouter_time:0.000225 app_id:"f30dc445-ab97-4b31-a6d1-ba55af2e9904" app_index:"3" instance_id:"0f3e9354-c4d6-44a7-5317-e8f3" x_cf_routererror:"-" x_b3_traceid:"rrt-0feccf7ffe3313799-b-ea-30858-61118700-3" x_b3_spanid:"0" x_b3_parentspanid:"-" b3:"-"
And there are also many "invalid B3 TraceID header found" messages in gorouter.stdout.log as shown below. 
{"log_level":1,"timestamp":1668093603.8758044,"message":"failed-to-parse-b3-trace-id","source":"vcap.gorouter","data":{"error":"invalid B3 TraceID header found"}}


Environment

Product Version: 2.11

Resolution

As indicated by the error message, the B3 TraceID included in HTTP header is not in valid format. It's mentioned in this document:
The X-B3-TraceId header is encoded as 32 or 16 lower-hex characters. For example, a 128-bit TraceId header might look like: X-B3-TraceId: 463ac35c9f6413ad48485a3953bb6124

However the application specifies an invalid B3 Trace ID in this case. It's like "rrt-0feccf7ffe3313799-b-ea-30858-61118700-3" in the example given above. 

So the solution should be to ask client (or upstream component) to set valid B3 Trace ID format in HTTP header.