openresty / openresty/lua-resty-core
How to get matched location_name on runtime by lua
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 853
- Forks
- 286
- Avg merge
- 35m
- Merged PRs (30d)
- 1
Description
In rewrite_by_lua phase, I want to get the matched location name on runtime。
For example:
nginx server config:
server {
listen 80;
server_name 127.0.0.1;
location /test {
return 200 "test";
}
location /test/api {
return 200 "test";
}
location ~ /id/\d* {
return 200 "api";
}
}
if I visit http://127.0.0.1/test/api/abc, I want get the nginx location name: /test/api
if I visit http://127.0.0.1/test/ddd, I want get the nginx location name: /test
if I visit http://127.0.0.1/id/123, I want get the nginx location name: /id/\d*
openresty version: 1.19.3.1
can you help me?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue mentions only the rewrite_by_lua phase and nginx location examples, with no repository files, tests, or implementation entry point. Start by checking the OpenResty and lua-nginx-module APIs for access to the selected location; done would be a confirmed supported approach or a clearly scoped documentation or feature request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- backend
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100