Skip to content

Indefinite length urls cannot be regularly matched? #30

@SenLinLeo

Description

@SenLinLeo

Hey, thanks for this library!
I want to ask a question, I want to routing of the URL is indefinite the length,such as: ip:7500/v1/foo/dir/test/......../test . There may be more levels. So I used regular matching, but.

  1. The POST method can't be used regularly and can't be matched.
  2. If the GET and POST methods are the same as the path, neither method can match.

code:

local r3route     = require "resty.r3"
local router_uri =
  {
      {
         path = "/v1/foo/{get_filename}",
         method = {"GET"},
        handler = main_controllers_get
     },
    {
       path = [[/v1/bar/{bucketname}/{get_filename:([\w-./])}]],
       method = {"GET"},
       handler = main_controllers_get
    },
   {
      path = "/v1/foo",
      method = {"POST"},
      handler = main_controllers_post
   },
  {
      path = [[/v1/bar/{bucketname}/{post_filename:([\w-./])}]],
     method = {"POST"},
     handler = main_controllers_post
   }
 }

 local r3 = r3route.new(router_uri)

 r3:compile()

 local ok = r3:dispatch(ngx.var.uri , ngx.req.get_method())
 if not ok then
    ngx.exit(403)
 end

How do you solve this problem?

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