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

Open
nanamikon opened this issue Jul 2, 2021 · 2 comments
Open

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

nanamikon opened this issue Jul 2, 2021 · 2 comments

Comments

@nanamikon
Copy link
Contributor

@nanamikon nanamikon commented Jul 2, 2021

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

@spacewander spacewander commented Jul 5, 2021

We can do the same trick like

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

PR is welcome!

@nanamikon
Copy link
Contributor Author

@nanamikon nanamikon commented Jul 6, 2021

get it, I will submit a pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants