You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "pavankumar-siripurapu (via GitHub)" <gi...@apache.org> on 2024/05/22 17:24:20 UTC
[I] help request: Setting cookie based on a condition. [apisix]
pavankumar-siripurapu opened a new issue, #11279:
URL: https://github.com/apache/apisix/issues/11279
### Description
we have a requirement to use a plugin, where we need to route the traffic on percentage basis. I'll give an example for better understanding.
we have an URL https://xyz.com/ca/fr/index.html where ca is country (canada) and fr is french language. Now the traffic needs to routed 10% to https://xyz.com/ca/en/index.html and the remaining 90% to https://xyz.com/ca/fr/index.html. And whenever we're routing the traffic to https://xyz.com/ca/en/index.html we need to set a cookie. So for next call, if the cookie is there, it should directly go to https://xyz.com/ca/en/index.html else it should go via a 10:90 traffic split. What is the best possible way to achieve this ??
### Environment
- APISIX version (run `apisix version`): 3.8.0
- Operating system (run `uname -a`):
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
- etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
- APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run `luarocks --version`):
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: Setting cookie based on a condition. [apisix]
Posted by "pavankumar-siripurapu (via GitHub)" <gi...@apache.org>.
pavankumar-siripurapu commented on issue #11279:
URL: https://github.com/apache/apisix/issues/11279#issuecomment-2170355193
Thank you so much for your explanation and demonstration. @nfrankel, we have already tried this technique. The only reason we were hit was because APISIX must set the cookie during the 10% traffic split.
To put it simply, when the first request arrives, we must perform a 10:90 traffic split, and for the 10% of traffic, APISIX has to set a cookie so that subsequent requests from that browser/user will travel the same upstream without requiring a traffic split. In brief, we want to achieve session affinity.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: Setting cookie based on a condition. [apisix]
Posted by "nfrankel (via GitHub)" <gi...@apache.org>.
nfrankel commented on issue #11279:
URL: https://github.com/apache/apisix/issues/11279#issuecomment-2170534775
In general, the upstreams sets the cookie and APISIX uses it later.
https://blog.frankel.ch/sticky-sessions-apache-apisix/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: Setting cookie based on a condition. [apisix]
Posted by "nfrankel (via GitHub)" <gi...@apache.org>.
nfrankel closed issue #11279: help request: Setting cookie based on a condition.
URL: https://github.com/apache/apisix/issues/11279
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: Setting cookie based on a condition. [apisix]
Posted by "nfrankel (via GitHub)" <gi...@apache.org>.
nfrankel commented on issue #11279:
URL: https://github.com/apache/apisix/issues/11279#issuecomment-2139138796
And that's it:
https://github.com/ajavageek/fixed-route-apisix/blob/master/apisix.yml
I'm in the process of writing a blog post about it if you need more details.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: Setting cookie based on a condition. [apisix]
Posted by "nfrankel (via GitHub)" <gi...@apache.org>.
nfrankel commented on issue #11279:
URL: https://github.com/apache/apisix/issues/11279#issuecomment-2156780049
Hey @pavankumar-siripurapu
I wrote a full-fledged [blog post](https://blog.frankel.ch/fixed-routes-apisix/) about your issue. Enjoy!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: Setting cookie based on a condition. [apisix]
Posted by "nfrankel (via GitHub)" <gi...@apache.org>.
nfrankel commented on issue #11279:
URL: https://github.com/apache/apisix/issues/11279#issuecomment-2138243293
Interesting question. I don't think it's that hard, let me prepare a demo repo.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org