Skip to content

Conversation

@abhide
Copy link
Member

@abhide abhide commented Aug 1, 2020

Tickets: GH-22290

@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Aug 1, 2020
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 1, 2020
@abhide abhide requested a review from howardjohn August 1, 2020 05:53
@abhide
Copy link
Member Author

abhide commented Aug 1, 2020

/test build_api

oneof rewrites {
// Rewrite HTTP URIs and Authority headers. Rewrite cannot be used with
// Redirect primitive. Rewrite will be performed before forwarding.
HTTPRewrite rewrite = 4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrite:
  authority:
  uri:
regexRewrite:
  regex:

Seems like these are the possible options, which raises the question to me - what is being rewritten by regex, the uri or the authority? And can I do a authority prefix rewrite along with a regex rewrite of uri?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is clear to users or consistent with the existing field. we should either change regex to uri or nest it under rewrite maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.. So I can nest rewriteRegex under rewrite. Will do that change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@howardjohn given that we can either have rewrite or regexRewrite have it nested under rewrite doesn't make sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I am not sure why it doesn't make sense?

rewrite:
  authority:
  uri:
regexRewrite:
  regex:

is clearly inconsistent to me.


rewrite:
  authority:
  uri:
    regix: ...
    prefix: ...

is ideal. However, it is not backwards compatible.


Therefor it seems that:

rewrite:
  authority:
  uri: ...prefix...
  uriRegix: ...regex..

is the most consistent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@howardjohn yes.. makes sense. fixed in latest changes.

@nrjpoddar
Copy link
Member

nrjpoddar commented Aug 8, 2020

@abhide can you add examples in the doc on how to use regex rewrite? This is a great functionality to add but will be difficult for users to follow without concrete examples.

@abhide
Copy link
Member Author

abhide commented Aug 20, 2020

@abhide can you add examples in the doc on how to use regex rewrite? This is a great functionality to add but will be difficult for users to follow without concrete examples.

@nrjpoddar Do you want me to add envoy regex examples? Essentially, we would be passing the values from VS to envoy config, correct?

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Aug 21, 2020
@istio-policy-bot istio-policy-bot added the lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while label Sep 23, 2020
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Sep 23, 2020
@abhide abhide removed the lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while label Sep 23, 2020
@istio-policy-bot istio-policy-bot added the lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while label Sep 23, 2020
@istio-policy-bot istio-policy-bot removed the lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while label Sep 23, 2020
@howardjohn
Copy link
Member

Do you want me to add envoy regex examples? Essentially, we would be passing the values from VS to envoy config, correct?

Yes please. An example of a simple regex (we don't need a complex one, we want to show how it can be used not how regex works), and the input URL and what it will be rewritten to.

@istio-testing istio-testing added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 20, 2020
@istio-testing istio-testing removed the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 20, 2020
@istio-testing istio-testing added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 20, 2020
@abhide
Copy link
Member Author

abhide commented Oct 20, 2020

@howardjohn @nrjpoddar Added a WIP patch that uses these API changes: istio/istio#28098

Looking for feedback/comments so that we can work through naming params and documentation.

UriRegexRewrite uri_regex = 3;
}

message UriRegexRewrite {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string authority = 2;

// uri_regex can be used for rewriting portions of path that match the
// pattern during forwarding the request
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// pattern during forwarding the request
// pattern when forwarding the request.

string authority = 2;

// uri_regex can be used for rewriting portions of path that match the
// pattern during forwarding the request
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// pattern during forwarding the request
// pattern when forwarding the request.

@guillevalin
Copy link

Hi istio team,

I've been following this issue and PR since september past year, we want to migrate to istio but we need regex rewrite rules to replace nginx-ingress.

Is there any chance this PR could be merged soon?

Thank you in advance.

@costinm
Copy link
Contributor

costinm commented Jan 26, 2021

I am a bit concerned with this - can you add a discussion on networking WG ?
AFAIK it is possible to use an EnvoyFilter to achieve this result - so advanced users who need this are not blocked.

I don't think Istio API must mirror all the features in envoy - right now the consensus in the WG is to adopt the upstream
K8S networking APIs, which in turn allow multiple implementation besides Istio. They do allow some 'extension points'
as well - but any extension point will be vendor-specific.

I don't think RE2 based rewrite a URL is a common enough feature that would be supported cross-vendor, and it puts
unreasonable requirements on non-envoy based implementations of Istio ( proxyless ).

@costinm
Copy link
Contributor

costinm commented Jan 26, 2021

At least we should bounce the idea with the K8S Services WG - and the other projects planning to support the K8S APIs.
I assume since this didn't make it to 1.9 we can afford few weeks to discuss with the relevant WGs.

@abhide
Copy link
Member Author

abhide commented Jan 26, 2021

I am not actively working on this GH issue. Will un-assign myself so that someone can pick it up.

@abhide abhide closed this Jan 26, 2021
@SpecialYang
Copy link
Member

SpecialYang commented Jan 27, 2021

I really need this awesome feature and want to support it. Can I pick it up? @howardjohn @hzxuzhonghu

@SpecialYang SpecialYang mentioned this pull request Jan 27, 2021
@dacloutier
Copy link

... AFAIK it is possible to use an EnvoyFilter to achieve this result - so advanced users who need this are not blocked.
...
I don't think RE2 based rewrite a URL is a common enough feature that would be supported cross-vendor, and it puts unreasonable requirements on non-envoy based implementations of Istio ( proxyless ).

@costinm I'm not sure how you can say that routing/rewriting with path variables is "unreasonable" "advanced" "uncommon"

Have you never written a API that's like this: /api/someresource/{some-id}/subresource-a & /api/someresource/{some-id}/subresource-b ?

@dacloutier
Copy link

@SpecialYang have you build a forked image for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.