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

Dynamically route prefix_rewrite #4274

Closed
Bhawna4tech opened this issue Aug 28, 2018 · 7 comments
Closed

Dynamically route prefix_rewrite #4274

Bhawna4tech opened this issue Aug 28, 2018 · 7 comments
Labels
enhancement Feature requests. Not bugs or questions. help wanted Needs help!

Comments

@Bhawna4tech
Copy link

Bhawna4tech commented Aug 28, 2018

How to dynamically route prefix_rewrite

Description:

I want to redirect an incoming request to envoy to one of my services.
For example: I have two services bookings and orders. I want to route to orders/{valueGiven}/sometask when the system gets the request for bookings/{valueGiven}/sometask. I tried doing below solution. It's not working as expected.

                    {
                        "match": {
                          "regex": "/bookings/(.*)/sometask"
                        },
                        "route": {
                          "prefix_rewrite": "/orders/$1/sometask",
                          "cluster": "order_service"
                        }
                      }

When I send request bookings/1234/sometask, system should route to orders/1234/sometask
In the logs I am getting : method=GET path="/orders/$1/sometask", order not found. The expected behavior should get path with the path parameters passed.

@zyfjeff
Copy link
Member

zyfjeff commented Aug 28, 2018

@Bhawna4tech the variable is not currently supported, there is no way to use $1 to refer to regular matching to the content

@techygarg
Copy link

@zyfjeff: Thanks for prompt response. As we have limited knowledge with Envoy so far, do you see any other feasible way, we can achieve it.

@zyfjeff
Copy link
Member

zyfjeff commented Aug 28, 2018

@techygarg #3977 This problem is very similar with you

@Bhawna4tech
Copy link
Author

@zyfjeff: Thanks for sharing the link. Yeah, it is same scenario. As no one has responded yet, it looks like it is not feasible currently in envoy, correct ?

@dio
Copy link
Member

dio commented Aug 28, 2018

It seems it is useful to have captured params to be used for subsequent prefix_rewrite-ing.

@BailyTroyer
Copy link

Has this been addressed? I am trying to do the same and have found no documentation regarding capture groups in envoy.

@zuercher
Copy link
Member

I'm closing this as a duplicate of #2092, which I believe is being worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. Not bugs or questions. help wanted Needs help!
Projects
None yet
Development

No branches or pull requests

7 participants