Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(traffic-split): binding upstream via upstream_id is invalid #3842

Merged
merged 3 commits into from
Mar 17, 2021

Conversation

Firstsawyou
Copy link
Contributor

@Firstsawyou Firstsawyou commented Mar 16, 2021

What this PR does / why we need it:

fix #3740
Related issues: #3787

Because the current traffic-split plug-in supports upstream_id to refer to the upstream by rewriting the value of ctx.matched_route.value.upstream_id. However, when the upstream_id is used by the route and the plugin at the same time, the rewriting of ctx will cause the upstream_id on the original cached route to be lost.
Therefore, this PR creates a temporary variable of ctx.upstream_id to cache the upstream_id configured in the plug-in, avoiding the modification of ctx.matched_route.value.upstream_id.

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

apisix/init.lua Outdated Show resolved Hide resolved
apisix/init.lua Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: the traffic-split plugin is invalid to bind upstream via upstream_id
3 participants