Modify Header always do first Endpoint

Branch/Environment/Version

  • Branch/Version: 3.2.2
  • Environment: On-prem

Describe the bug
A clear and concise description of what the bug is.

Reproduction steps
Steps to reproduce the behaviour:

  1. Add api

  2. Add 2 endpoints with different regular expression, use Modify headers and URL rewrite plugins
    for example
    1st with http://httpbin.org/anything?detail
    with response header… function: content detail
    2nd with http://httpbin.org/anything?list
    with response header… function: content list

  3. Test url that match 2nd endpoint

Actual behaviour
url correctly return 2nd endpoint with 1st header (function: content detail)

Expected behaviour
url correctly return 2nd endpoint with 2nd header (function: content list)

Screenshots/Video
setting example

Additional context
It seem tyk always return response header of first endpoint in list. We try other plugins such as Cache and it’s correctly use the correct matching

Hello @NPh,

Can you please send us the API definition?

Sure
As we can ignore about header, we remove it. But I re-create it here.
Please look at V1. V2 is real thing so there’s too many of them.
https://drive.google.com/file/d/1lumuZW8lnmga3AV2M0n56_Bo3n_upVqJ/view?usp=sharing

The new problem arise (but the same area i.e. modify header), unlike last Friday. Any path match with regex, even simple one have no response header. Only plain text path: /v1/contents2/x give the response header.

This one has it

This one has no response header

Hi @NPh. I have tested and confirmed your report. I will check with the team and let you know the feedback

Hi!

@NPh 've noticed big issue in your API in V1 version.

In URL rewrite plugin in all endpoints in match pattern you have .* everywhere for all endpoints.
When you set match pattern, it replace the value which you put in “relative path”, and now it matches the first endpoint in list (or maybe just random endpoint).

With URL rewrite you can treat “Relative path” as human readable path, and the actual match specified in URL rewrite plugin.