Skip to content

Commit

Permalink
Handle REQUEST_URI with base url
Browse files Browse the repository at this point in the history
This has been reported to happen on WEBrick, it may happen in other ways
depending on how the variable is set.
  • Loading branch information
lloeki committed Oct 26, 2022
1 parent b366384 commit e38bf92
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/datadog/tracing/contrib/rack/middlewares.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,12 @@ def parse_url(env, original_env)

query_string.empty? ? path : "#{path}?#{query_string}"
else
request_uri
# normally REQUEST_URI starts at the path, but it
# might contain the full URL in some cases (e.g WEBrick)
request_uri.sub(/^#{base_url}/, '')
end

::URI.join(base_url, fullpath).to_s
base_url + fullpath
end

def parse_user_agent_header(headers)
Expand Down

0 comments on commit e38bf92

Please sign in to comment.