-
Notifications
You must be signed in to change notification settings - Fork 170
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
Routing policy issues with URL rewrite policy. #1084
Comments
Shouldn't it be just matter of documenting that the rewrite happens first and the routing happens on the rewritten URI? |
The use case I am having here is about using 3scale with the Strimzi Kafka bridge having more bridge instances backed by one 3scale apicast. |
Ok, that is a very valid use case I think. If the rewrite policy would store the original URL before the rewrite, then the routing policy could just use that one instead. That would allow people to chose if they want to use the URL before or after rewrite. |
I agree that this is something that we need to address. We'll try to provide a fix for the next release (3.7.0). |
Hi, I was checking this, but it's not as easy as looks like, at the moment we have the following phases in Openresty:
The url_rewrite policy happens on the rewrite phase, and that's is the natural place to do that. The routing policy occurs in the content phase, and it's not a logical phase at all. There is a good reason for that; body information in the rewrite phase is not available. Due to routing policy needs access to JWT, can route based on JWT claims, headers and information it's almost impossible to integrate this on the rewrite phase. I propose to move Regards |
The policy phases map to nginx phases. We should keep the 1:1 mapping between policy phases and ngninx phases. Policies can totally be configured to operate on different phases by own configuration. But on which phase it can operate should be left to the policy author, we should not try to merge two nginx phases into one of ours. JWT is available in a header, not in a body. So it can totally operated on rewrite phase. I don't see why we can't have both. Just offer the original request URI in some other variable, so the routing policy can access both. |
Ok, about to pass the original URI, the thing is that it's used on so, users can use |
Strings are immutable in Lua, so as long as they are the same strings it should be using the same memory. And then after a rewrite there would be some copy of it anyway until the request finishes. Yep, adding it to the liquid context is the way IMO. So it is availabe for other policies too. It can be done when the context is first allocated. |
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
To be able to retrieve original request information on the policies without adding/deleting headers. This change allows users to handle routing policy with the original information, full disclosure on issue 3scale#1084 Fix 3scale#1084 Signed-off-by: Eloy Coto <[email protected]>
Hi,
When URL rewrite changes the URI, the routing policy will no longer work with the original URI, so if the user needs to do the rewrite will never happen, due to the rewrite in routing policies happens on content phase.
Invalid config:
The only way to fix this is with a new header, but the routing policy decision should happen on the rewrite phase.
The text was updated successfully, but these errors were encountered: