'Istio - way to add prefix to route/destination?
Currently have Istio deployed to handle the ingress to my applications. Running into an issue where one app needs to be reachable via a certain URL such as "http://gateway/webapp1" and I need it to route internally to: server-name1:8080/some/odd/name/path
The current match statement I have is:
- match:
- uri:
prefix: /webapp1
route:
- destination:
host: server-name1
port:
number: 8080
I am unable to figure out how to expand on the destination route to tell it to hit a different endpoint that just server-name1:8080. Is there a simple way to add a prefix to the underlying route/destination? Thank you.
Solution 1:[1]
You can use the HTTP rewrite with the virtual service before sending traffic further
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: ratings-route
spec:
hosts:
- ratings.prod.svc.cluster.local
http:
- match:
- uri:
prefix: /webapp1
rewrite:
uri: /gateway/webapp1
route:
- destination:
host: server-name1
port:
number: 8080
Read more at official document : https://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPRewrite
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Harsh Manvar |
