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

How to get matched location_name on runtime by lua #336

Open
Namesen opened this issue Feb 3, 2021 · 0 comments
Open

How to get matched location_name on runtime by lua #336

Namesen opened this issue Feb 3, 2021 · 0 comments

Comments

@Namesen
Copy link

Namesen commented Feb 3, 2021

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?

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

No branches or pull requests

1 participant