and what do you mean by not working?
*ZhengSong Tu*
My GitHub: https://github.com/tzssangglass
Apache APISIX: https://github.com/apache/apisix

Alexandre SOLOVIEFF <alexandre.solovi...@4sh.fr> 于2022年2月21日周一 18:03写道:
>
> And when I use the same config :
>
> \"proxy-rewrite\": {
>       \"headers\": {
>         \"X-USER-ID\": \"USER1-ID\"
>       }
>     }
>
> In the route config it works :
>
> curl --location --request PUT
> "http://$APISIX_URL:$APISIX_PORT/apisix/admin/routes/api-v1"; \
> --header "X-API-KEY: $APISIX_API_ADMIN_KEY" \
> --header "Content-Type: application/json" \
> --data-raw "{
>   \"uri\": \"/v1/*\",
>   \"host\": \"$APISIX_HOST\",
>   \"plugins\": {
>     \"key-auth\": {},
>     \"consumer-restriction\": {
>         \"whitelist\": [
>             \"user1\",
>             \"user2\"
>         ]
>     },
>     \"proxy-rewrite\": {
>       \"headers\": {
>         \"X-USER-ID\": \"USER1-ID\"
>       }
>     }
>   },
>   \"service_id\": \"api-v1\"
> }"
>
>
> Le lun. 21 févr. 2022 à 10:31, Alexandre SOLOVIEFF <
> alexandre.solovi...@4sh.fr> a écrit :
>
> > Hi, here the configuration I tried to use :
> >
> > curl --location --request PUT 
> > "http://$APISIX_URL:$APISIX_PORT/apisix/admin/consumers"; \
> > --header "X-API-KEY: $APISIX_API_ADMIN_KEY" \
> > --header "Content-Type: application/json" \
> > --data-raw "{
> >   \"username\": \"user1\",
> >   \"plugins\": {
> >     \"key-auth\": {
> >       \"key\": \"key-of-user1\"
> >     },
> >     \"proxy-rewrite\": {
> >       \"headers\": {
> >         \"X-USER-ID\": \"USER1-ID\"
> >       }
> >     }
> >   }
> > }"
> >
> >
> > Le lun. 21 févr. 2022 à 09:15, ZhengSong Tu <tzssanggl...@gmail.com> a
> > écrit :
> >
> >> hi, can you show details about this configuration not working? This
> >> configuration should work. This way we can check it more quickly.
> >>
> >> *ZhengSong Tu*
> >> My GitHub: https://github.com/tzssangglass
> >> Apache APISIX: https://github.com/apache/apisix
> >>
> >> Alexandre SOLOVIEFF <alexandre.solovi...@4sh.fr> 于2022年2月15日周二 16:39写道:
> >> >
> >> > Hi,
> >> >
> >> > The configuration of proxy-rewrite directly on the consumers like you
> >> > proposed is exactly what I need but it does not seem to work.
> >> >
> >> > Best regards,
> >> >
> >> > Le lun. 14 févr. 2022 à 09:07, Zhiyuan Ju <juzhiy...@apache.org> a
> >> écrit :
> >> >
> >> > > Hi,
> >> > >
> >> > > To make sure you could receive the mail, I just forwarded it to you.
> >> > >
> >> > > Best Regards!
> >> > > @ Zhiyuan Ju <https://github.com/juzhiyuan>
> >> > >
> >> > >
> >> > > ---------- Forwarded message ---------
> >> > > 发件人: Zexuan Luo <spacewan...@apache.org>
> >> > > Date: 2022年2月14日周一 09:41
> >> > > Subject: Re: [APISIX] - Configure the plugin proxy-rewrite on consumer
> >> > > To: <dev@apisix.apache.org>
> >> > >
> >> > >
> >> > > The variable in header feature can be found in:
> >> > > https://apisix.apache.org/docs/apisix/plugins/proxy-rewrite
> >> > >
> >> > > And the variable list can be found in:
> >> > > https://apisix.apache.org/docs/apisix/apisix-variable
> >> > >
> >> > > Zexuan Luo <spacewan...@apache.org> 于2022年2月14日周一 09:31写道:
> >> > > >
> >> > > > What about configuring the proxy-rewrite plugin in the consumer?
> >> Like
> >> > > this:
> >> > > > ```
> >> > > > $ curl http://127.0.0.1:9080/apisix/admin/consumers -H 'X-API-KEY:
> >> > > > edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
> >> > > > {
> >> > > >     "username": "jack",
> >> > > >     "plugins": {
> >> > > >         "key-auth": {
> >> > > >             "key": "auth-one"
> >> > > >         },
> >> > > >         "proxy-rewrite": {
> >> > > >             "headers": {
> >> > > >                "X-CONSUMER-ID": "$consumer_name"
> >> > > >             },
> >> > > >             ...
> >> > > >         }
> >> > > >     }
> >> > > > }'
> >> > > >
> >> > > > ```
> >> > > >
> >> > > > Alexandre SOLOVIEFF <alexandre.solovi...@4sh.fr> 于2022年2月14日周一
> >> 07:10写道:
> >> > > > >
> >> > > > > Hi,
> >> > > > >
> >> > > > > My case scenario :
> >> > > > > I want to add a custom header (ex: X-CONSUMER-ID) which value
> >> depends
> >> > > of
> >> > > > > the consumer identified by its api key. And so for two consumer
> >> > > consumer-01
> >> > > > > and consumer-02 I want to proxy the request to which I added the
> >> header
> >> > > > > X-CONSUMER-ID=consumer-01-id or X-CONSUMER-02-id depending of
> >> who've
> >> > > done
> >> > > > > the call.
> >> > > > >
> >> > > > > So to summarize, I want to add a header in all cases but the value
> >> > > shall
> >> > > > > depend on the target consumer.
> >> > > > >
> >> > > > > Best regards,
> >> > > > >
> >> > > > > Le sam. 12 févr. 2022 à 11:16, Zhiyuan Ju <juzhiy...@apache.org>
> >> a
> >> > > écrit :
> >> > > > >
> >> > > > > > Hi,
> >> > > > > >
> >> > > > > > > want to do is configure it on the consumer.
> >> > > > > >
> >> > > > > > Just to make sure, do you want to only execute this plugin on a
> >> > > target
> >> > > > > > consumer? If yes, you could use the consumer-restriction
> >> plugin[1],
> >> > > but it
> >> > > > > > still needs to work with Route: Route + Consumer + Plugin.
> >> > > > > >
> >> > > > > > More detailed scenarios could be helpful to all of us, and let's
> >> > > wait for
> >> > > > > > other members' thoughts.
> >> > > > > >
> >> > > > > > [1]
> >> > > https://apisix.apache.org/docs/apisix/plugins/consumer-restriction/
> >> > > > > >
> >> > > > > > Best Regards!
> >> > > > > > @ Zhiyuan Ju <https://github.com/juzhiyuan>
> >> > > > > >
> >> > > > > >
> >> > > > > > Ming Wen <wenm...@apache.org> 于2022年2月11日周五 10:10写道:
> >> > > > > >
> >> > > > > >> I cc this email to dev@apisix.a.o
> >> > > > > >>
> >> > > > > >> Thanks,
> >> > > > > >> Ming Wen, Apache APISIX PMC Chair
> >> > > > > >> Twitter: _WenMing
> >> > > > > >>
> >> > > > > >>
> >> > > > > >> Alexandre SOLOVIEFF <alexandre.solovi...@4sh.fr> 于2022年2月10日周四
> >> > > 23:49写道:
> >> > > > > >>
> >> > > > > >> > Hello,
> >> > > > > >> > I am currently trying to add a new header and I can do it
> >> with the
> >> > > > > >> plugin
> >> > > > > >> > proxy-rewrite. But this plugin can only be configured on
> >> routes
> >> > > and
> >> > > > > >> what I
> >> > > > > >> > want to do is configure it on the consumer. Is there a way
> >> to do
> >> > > it ?
> >> > > > > >> >
> >> > > > > >> > Best regards
> >> > > > > >> >
> >> > > > > >> > --
> >> > > > > >> > [image: Profile]
> >> > > > > >> > *Alexandre* Solovieff [image: 4SH]Développeur
> >> > > > > >> >
> >> > > > > >> >
> >> > > > > >> > +33 (0)9 63 28 62 73 <+33+(0)9+63+28+62+73> ◆ +33 (0)9 63 28
> >> 62 73
> >> > > > > >> > <+33+(0)9+63+28+62+73>
> >> > > > > >> >
> >> > > > > >>
> >> > > > > >
> >> > > > >
> >> > > > > --
> >> > > > > [image: Profile]
> >> > > > > *Alexandre* Solovieff [image: 4SH]Développeur
> >> > > > >
> >> > > > >
> >> > > > > +33 (0)9 63 28 62 73 <+33+(0)9+63+28+62+73> ◆ +33 (0)9 63 28 62 73
> >> > > > > <+33+(0)9+63+28+62+73>
> >> > >
> >> >
> >> >
> >> > --
> >> > [image: Profile]
> >> > *Alexandre* Solovieff [image: 4SH]Développeur
> >> >
> >> >
> >> > +33 (0)9 63 28 62 73 <+33+(0)9+63+28+62+73> ◆ +33 (0)9 63 28 62 73
> >> > <+33+(0)9+63+28+62+73>
> >>
> >
> >
> > --
> > [image: Profile]
> > *Alexandre* Solovieff [image: 4SH]Développeur
> >
> >
> > +33 (0)9 63 28 62 73 <+33+(0)9+63+28+62+73> ◆ +33 (0)9 63 28 62 73
> > <+33+(0)9+63+28+62+73>
> >
>
>
> --
> [image: Profile]
> *Alexandre* Solovieff [image: 4SH]Développeur
>
>
> +33 (0)9 63 28 62 73 <+33+(0)9+63+28+62+73> ◆ +33 (0)9 63 28 62 73
> <+33+(0)9+63+28+62+73>

Reply via email to