[GitHub] [apisix-dashboard] bzp2010 commented on issue #2284: APISIX DASHBOARD: how to use regex to strict match uri with both path and query params in a single request
bzp2010 commented on issue #2284: URL: https://github.com/apache/apisix-dashboard/issues/2284#issuecomment-1022920994 @stutipatelorigo NoNoNo, I give the JSON writing method in the Admin API, you need to take the content in quotes and write it in the `regexp` and `template` lines respectively. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] bzp2010 commented on issue #2284: APISIX DASHBOARD: how to use regex to strict match uri with both path and query params in a single request
bzp2010 commented on issue #2284: URL: https://github.com/apache/apisix-dashboard/issues/2284#issuecomment-1022799905 @stutipatelorigo You can use the `regex_uri`. ```json { "regex_uri": ["^/sw/users/(.*)", "/users/$1"] } ``` The above code is not syntax-checked, you need to pay attention to it. However, the ideas it contains are completely correct. This is the content of Nginx's rewrite directive, and you can use the experience about it to do this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] bzp2010 commented on issue #2284: APISIX DASHBOARD: how to use regex to strict match uri with both path and query params in a single request
bzp2010 commented on issue #2284: URL: https://github.com/apache/apisix-dashboard/issues/2284#issuecomment-1022796751 @stutipatelorigo You can use the proxy-rewrite[[1]](https://apisix.apache.org/docs/apisix/plugins/proxy-rewrite) plugin. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] bzp2010 commented on issue #2284: APISIX DASHBOARD: how to use regex to strict match uri with both path and query params in a single request
bzp2010 commented on issue #2284: URL: https://github.com/apache/apisix-dashboard/issues/2284#issuecomment-1022783180 Hi, @stutipatelorigo You can create multiple routes with different priorities for the different paths you need to match, and they will be matched in turn. Again, no matter what optimizations are made to match regular expressions, it is a costly operation to perform and you may want to avoid performing one or more regular matches per request by other engineering means whenever possible. For example, using a header, a cookie, or some kind of token containing the above information (you can handle it with a custom plugin) are relatively more viable options. If we were to natively support the `{params}` syntax, as some Golang frameworks do, we wouldn't be able to use radixtree to provide extremely efficient route matching, so using this pattern would cause performance degradation in either the route matching phase or the HTTP request processing phase, so it's a tradeoff. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] bzp2010 commented on issue #2284: APISIX DASHBOARD: how to use regex to strict match uri with both path and query params in a single request
bzp2010 commented on issue #2284: URL: https://github.com/apache/apisix-dashboard/issues/2284#issuecomment-1010551170 We don't have any formal way to do this work, even APISIX can't support it. But here we can do this indirectly using some methods. Firstly, using this function. ![image](https://user-images.githubusercontent.com/8078418/149049496-145566b9-051c-4fe5-8d9a-1c7de928a041.png) Config the uri match (the var `uri` is the pure URI and the `request_uri` will include query params `?xxx=xxx`) ![image](https://user-images.githubusercontent.com/8078418/149049562-c2327c2b-40e2-4a18-9a4f-8e74a44579ce.png) Config the query match ![image](https://user-images.githubusercontent.com/8078418/149049702-865fa14b-13e8-4741-ba74-82f6a5dc72e7.png) **However, keep in mind that this is not the "right" way to use it, and while it does work, it may cause performance degradation or other problems.** -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org