You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "sampy2518 (via GitHub)" <gi...@apache.org> on 2024/01/25 18:38:21 UTC

Re: [I] help request: Is it possible to apply the same plugins to multiple routes with different upstream? [apisix]

sampy2518 commented on issue #6865:
URL: https://github.com/apache/apisix/issues/6865#issuecomment-1910775425

   I have a peculiar situation in my project where I am trying to replace my existing old Proxy code with APISIX. my current proxy backtrack the versions apis and services in a different way. for example. 
   API Versions available : V1, V2, V3
   
   Routes should be created in below format 
   V1
   	API1 
   		Service1
   		Service2 
   	API2
   		Service3
   		Service4
   	API3
   		Service5
   
   V2
   	API2
   		Service4
   	API4 
   		Service6
   V3
   	API2
   		Service4
   	API5 
   		Service7
   
   API routing, fallback and backtracking rules to follow 
   case 1:  	
   APP A : current Version used V2. All any API from the frontend will be called with V2
   
   Invoke V2/API1/Service1/ will be redirected to V1/API1/Service1, As it is not present in current version V2, so it will backtrack or fallback to previous version which is V1 and search for the Service1 in API1.
   
   Invoke V2/API1/Service2/ will be redirected to V1/API1/Service2, As it is not present in current version V2, so it will backtrack or fallback to previous version which is V1 and search for the Service2 in API1.
   
   Invoke V2/API2/Service3/ will be redirected to V1/API2/Service3, As it is not present in current version V2, so it will backtrack or fallback to previous version which is V1 and search for the Service3 in API2.
   
   Invoke V2/API2/Service4/ will be redirected to V2/API2/Service4, As it is present in V2
    
   Invoke V2/API3/Service5/ will be redirected to V1/API3/Service5, As it is not present in current version V2, so it will backtrack or fallback to previous version which is V1 and search for the Service5 in API3.
   
   Invoke V2/API4/Service6/  will be redirected to V2/API4/Service6, As it is present in V2
   
   case 2:  	
   APP b : current Version used V3. All any API from the frontend will be called with V3
   
   Invoke V3/API1/Service1/ will be redirected to V1/API1/Service1, As it is not present in current version V3, so it will backtrack or fallback to previous version which is V1 and search for the Service1 in API1.
   
   Invoke V3/API1/Service2/ will be redirected to V1/API1/Service2, As it is not present in current version V3, so it will backtrack or fallback to previous version which is V1 and search for the Service2 in API1.
   
   Invoke V3/API2/Service3/ will be redirected to V1/API2/Service3, As it is not present in current version V3, so it will backtrack or fallback to previous version which is V1 and search for the Service3 in API2.
   
   Invoke V3/API2/Service4/ will be redirected to V3/API2/Service4, As it is present in V3
    
   Invoke V3/API3/Service5/ will be redirected to V1/API3/Service5, As it is not present in current version V3, so it will backtrack or fallback to previous version which is V1 and search for the Service5 in API3.
   
   Invoke V3/API4/Service6/ will be redirected to V2/API4/Service6, As it is not present in current version V3, so it will backtrack or fallback to previous version which is V2 and search for the Service6 in API4.
   
   Invoke V3/API4/Service7/ will be redirected to V3/API5/Service7, As it is present in V3
   
   I would like to ask how can i define a customer global plugin which is work when for any incoming request from client and rewrite the URL as per above rule. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org