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

request help: How to deal with arg with dash in the plugin's setting #4519

Closed
nanamikon opened this issue Jul 2, 2021 · 2 comments
Closed
Labels
good first issue Good for newcomers

Comments

@nanamikon
Copy link
Contributor

Issue description

Some plugins support vars matching, such as traffic-split.

"plugins": {
        "traffic-split": {
            "rules": [
                {
                    "match": [
                        {
                            "vars": [
                                ["arg_name","==","test"]
                            ]
                        }
                    ],
                    "weighted_upstreams": [
                        {
                            "upstream": {
                                "name": "upstream_A",
                                "type": "roundrobin",
                                "nodes": {
                                    "127.0.0.1:1981":10
                                }
                            }
                        }
                    ]
                }
            ]
        }
    }

If I want to check an arg with dash (ex: test-name), I have to get this arg using regex from nginx.var.args refer to https://marc.info/?l=nginx&m=141589036701879&w=2.

So how to match this type of args in the plugin setting ? I can't get any tips from https://github.com/api7/lua-resty-expr#operator-list

Thank you

Environment

Request help without environment information will be ignored or closed.

  • apisix version (cmd: apisix version):
  • OS (cmd: uname -a):
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):
  • apisix-dashboard version, if have:
  • luarocks version, if the issue is about installation (cmd: luarocks --version):
@spacewander
Copy link
Member

We can do the same trick like

elseif core_str.has_prefix(key, "cookie_") then

PR is welcome!

@spacewander spacewander added the good first issue Good for newcomers label Jul 5, 2021
@nanamikon
Copy link
Contributor Author

get it, I will submit a pr

nanamikon pushed a commit to nanamikon/apisix that referenced this issue Jul 26, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Jul 27, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Jul 30, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Jul 30, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Jul 30, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Aug 3, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Aug 3, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Aug 3, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Aug 3, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Aug 3, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Aug 4, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Aug 4, 2021
nanamikon pushed a commit to nanamikon/apisix that referenced this issue Aug 5, 2021
spacewander pushed a commit that referenced this issue Aug 6, 2021
Co-authored-by: Alex Zhang <tokers@apache.org>
Co-authored-by: tzssangglass <tzssangglass@gmail.com>
Co-authored-by: jianzhou <zhoujian1@huya.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants