apache / apisix-dashboard

Dashboard for Apache APISIX
https://apisix.apache.org/
Apache License 2.0
1.01k stars 528 forks source link

support vars in URI #1919

Closed hozaifaaoud closed 2 years ago

hozaifaaoud commented 3 years ago

How can I add vars in uri? And how can I create a route like this Http://127.0.0.1:9080/tel/{TelNum}/email/{EmailAdd}

iamayushdas commented 3 years ago

Hey @hozaifaaoud have you tried it by adding route path as you stated.

hozaifaaoud commented 3 years ago

Yes, and I am facing this issue image

iamayushdas commented 3 years ago

@starsz, @nic-chen, @imjoey, @juzhiyuan have a look here. Thank you

starsz commented 3 years ago

Add vars in uri is not support.

But you can try to use var filed in route. refer: https://github.com/apache/apisix/blob/master/docs/en/latest/admin-api.md#route

Like this:

 "vars": [["uri", "~~", "{your regex}"]],
nic-chen commented 3 years ago

please refer to:

https://github.com/apache/apisix/blob/master/docs/en/latest/router-radixtree.md#5-parameter-match

https://github.com/api7/lua-resty-radixtree/#parameters-in-path

liuxiran commented 3 years ago

Hi @hozaifaaoud , have our answers solved your problem? If not, please update more details, or we consider the problem solved and will close it after three days, thanks a lot

imjoey commented 3 years ago

please refer to:

https://github.com/apache/apisix/blob/master/docs/en/latest/router-radixtree.md#5-parameter-match

https://github.com/api7/lua-resty-radixtree/#parameters-in-path

@starsz @nic-chen @liuxiran

Hi all, according to the docs, the parameter radixtree_uri_with_parameter allows users to set /blog/:name as the uri which could match /blog/dog and /blog/:cat. I was wondering that if we can also use it in regex_uri? For example, if regex_uri is set to [" /iresty/:p1/:p2/:p3", "/x:p1/y:p2/z:p3"], apisix could match request with /iresty/name/age/gender and rewrite the request url to /xname/yage/zgender and then send to the upstreams.

Looking forward to your feedbacks. Thanks.

liuxiran commented 3 years ago

please refer to: https://github.com/apache/apisix/blob/master/docs/en/latest/router-radixtree.md#5-parameter-match https://github.com/api7/lua-resty-radixtree/#parameters-in-path

@starsz @nic-chen @liuxiran

Hi all, according to the docs, the parameter radixtree_uri_with_parameter allows users to set /blog/:name as the uri which could match /blog/dog and /blog/:cat. I was wondering that if we can also use it in regex_uri? For example, if regex_uri is set to [" /iresty/:p1/:p2/:p3", "/x:p1/y:p2/z:p3"], apisix could match request with /iresty/name/age/gender and rewrite the request url to /xname/yage/zgender and then send to the upstreams.

Looking forward to your feedbacks. Thanks.

also cc @spacewander to help take a look, thanks a lot

spacewander commented 3 years ago

radixtree_uri_with_parameter is disabled by default. And it has a design defect: ':' is a valid character in the URL, so it is not recommended to enable it.

liuxiran commented 3 years ago

radixtree_uri_with_parameter is disabled by default. And it has a design defect: ':' is a valid character in the URL, so it is not recommended to enable it.

thanks for @spacewander 's reply, also cc @imjoey @hozaifaaoud to kown.

As vars in url is helpful for some users, I wonder if we have plan to Improve this feature?

imjoey commented 3 years ago

radixtree_uri_with_parameter is disabled by default. And it has a design defect: ':' is a valid character in the URL, so it is not recommended to enable it.

thanks for @spacewander 's reply, also cc @imjoey @hozaifaaoud to kown.

As vars in url is helpful for some users, I wonder if we have plan to Improve this feature?

That would be great. Uses could use these vars to design complicated route match rules, as well as request parameter rewrite.

github-actions[bot] commented 3 years ago

This issue has been marked as stale due to 30 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

hozaifaaoud commented 3 years ago

any good news

juzhiyuan commented 3 years ago

AFAIK, no plan to support this, but PR is welcome.

github-actions[bot] commented 2 years ago

This issue has been marked as stale due to 30 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

github-actions[bot] commented 2 years ago

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.