You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by Zeping Bai <bz...@apache.org> on 2022/10/26 04:42:22 UTC

[DISCUSS] Correct the misfit behavior in proxy-rewrite and proxy-mirror plugins

Background:

As I mentioned in the issue [1], the URI rewriting feature of proxy-rewrite
and
the adaptive URI of proxy-mirror do not work at the same time. proxy-mirror
will still use the URI before rewriting, which is a plugin incompatibility
case.

Discuss:

If we want to solve this problem, we need to modify the path in the
proxy-mirror
to give preference to the rewritten upstream_uri value if the uri and
upstream_uri
do not match.

This change is considered a breaking change, so we need to discuss it in the
community, what do you think about it?

[1] https://github.com/apache/apisix/issues/8167
[2]
https://github.com/apache/apisix/blob/master/apisix/plugins/proxy-mirror.lua#L86-L87

Re: [DISCUSS] Correct the misfit behavior in proxy-rewrite and proxy-mirror plugins

Posted by Nicolas Frankel <ni...@api7.ai>.
Hello,

I'm the one who uncovered the issue so I want to explain it. The use-case
is the following:

I've deployed v1 of my application. It's accessible through Apache APISIX
via /v1/hello. The proxy-rewrites removes the /v1 prefix to send /hello to
my upstream app.

Before migrating to v2, I want to check that everything works as expected.
Hence, I proxy-mirror the production to v2. I want the /v1 prefix to be
removed so v2 receives /hello and not /v1/hello.

Under the current circumstances, it cannot work.

On Wed, Oct 26, 2022 at 6:42 AM Zeping Bai <bz...@apache.org> wrote:

> Background:
>
> As I mentioned in the issue [1], the URI rewriting feature of proxy-rewrite
> and
> the adaptive URI of proxy-mirror do not work at the same time. proxy-mirror
> will still use the URI before rewriting, which is a plugin incompatibility
> case.
>
> Discuss:
>
> If we want to solve this problem, we need to modify the path in the
> proxy-mirror
> to give preference to the rewritten upstream_uri value if the uri and
> upstream_uri
> do not match.
>
> This change is considered a breaking change, so we need to discuss it in
> the
> community, what do you think about it?
>
> [1] https://github.com/apache/apisix/issues/8167
> [2]
>
> https://github.com/apache/apisix/blob/master/apisix/plugins/proxy-mirror.lua#L86-L87
>