diff --git a/lib/datadog/tracing/contrib/rack/middlewares.rb b/lib/datadog/tracing/contrib/rack/middlewares.rb index 3c4f43d3f61..fc2662c95ca 100644 --- a/lib/datadog/tracing/contrib/rack/middlewares.rb +++ b/lib/datadog/tracing/contrib/rack/middlewares.rb @@ -147,7 +147,7 @@ def set_request_tags!(trace, request_span, env, status, headers, response, origi # # To account for the unaccounted nested rack requests of /rack/hello/world, # we use 'PATH_INFO knowing that rack cannot have named parameters - if last_script_name == '' && env['SCRIPT_NAME'] != '' + if last_script_name == '' && env['SCRIPT_NAME'] && env['SCRIPT_NAME'] != '' last_script_name = last_route last_route = env['PATH_INFO'] end