Skip to content

request help: how to use regex in redirect plugin? #4140

Description

@JanLi-air

Issue description

I need to configure route which implement similar logic as this nginx config:

location ~ ^/foo/bar(/.*)? {
                return 302 $scheme://$host/app/bar$1$is_args$args;
}

But in redirect plugin I can only use $uri, which will contains /foo which I want to remove in the redirct locaton.

Environment

  • apisix version (cmd: apisix version): 2.0
  • OS (cmd: uname -a): Linux
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V): 1.19.3.1
  • 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):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions