question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Identifier does not return on first successful match

See original GitHub issue

According to linkerd docs: https://linkerd.io/config/1.0.0/linkerd/index.html#http-1-1-identifiers

If a list of identifiers is provided, each identifier is tried in turn until one successfully assigns a logical name to the request.

If I have a list of identifier as:

routers:
- protocol: http
  identifier:
    kind: io.l5d.header.token
    header: Custom-Header
  identifier:
    kind: io.l5d.path
    segments: 1
    consume: true

I would expect linkerd to return if the Custom-Header is included in the request and a match is made (not try path identifier). Currently I am seeing linkerd still try to route the service to the constructed path when the header is included.

$ http GET linkerd:4140/api/v1/hello Custom-Header:hello-world
HTTP/1.1 502 Bad Gateway
Content-Encoding: gzip
Content-Length: 106
Content-Type: text/plain
l5d-err: No+hosts+are+available+for+%2Fsvc%2Fapi%2C+Dtab.base%3D%5B%5D%2C+Dtab.local%3D%5B%5D.+Remote+Info%3A+Not+Available

No hosts are available for /svc/api, Dtab.base=[], Dtab.local=[]. Remote Info: Not Available

The service works correctly when I try to use the path identifier with and without the header.

If I reverse the order of the identifiers in the config I get a different error when using only path identifier with no Custom-Header:

Unknown Destination: Request("GET /hello-world/api/v1/hello", from /x.x.x.x:xxxx) / Custom-Header is absent.

Is this expected behavior?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
adleongcommented, May 1, 2017

Yes, that will use the header if it is present and fall back to the path otherwise.

1reaction
adleongcommented, May 1, 2017

You have the identifier property set twice in your linkerd config which will cause the first identifier to be overriden/replaced by the second one. Instead, you should provide a list of identifiers:

routers:
- protocol: http
  identifier:
  - kind: io.l5d.header.token
    header: Custom-Header
  - kind: io.l5d.path
    segments: 1
    consume: true

The difference is pretty subtle. I’ve filed https://github.com/linkerd/linkerd/issues/1262 to make it so that duplicate properties will raise an error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Case in SQL join not stopping at first successful match
I'm currently working with a B2B sales database that doesn't have a unique identifier for each customer. New records are allocated an ID...
Read more >
Find the Matching Value When the Lookup Value Is Not on the ...
This article shows you how to find matching value when the lookup value is not on the first column of the table array....
Read more >
Social Security Number | 2022-2023 Federal Student Aid ...
No match is performed if the student doesn't sign the FAFSA or provide a last name or birth date. The student's FAFSA will...
Read more >
Effective Go - The Go Programming Language
Since the memory returned by new is zeroed, it's helpful to arrange when designing your data structures that the zero value of each...
Read more >
Db2 11 - SQL error codes - IBM
THE NUMBER OF ELEMENTS ON EACH SIDE OF A PREDICATE OPERATOR DOES NOT MATCH. PREDICATE OPERATOR IS operator . -219. THE REQUIRED EXPLANATION...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found