Rewrite all request targets in istio ingress controller

In the process of testing out Istio I'm in need of rewriting all incomming requests on the Istio ingress controller in the same manner as with Kubernetes's own ingress controller, where I use the rewrite-target annotation.

# Existing Kubernetes ingress configuration
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: api
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:    
  rules:
  - host: some.host.com
    http:
      paths:
      - path: /svc
        backend:
          serviceName: svc
          servicePort: 80

This makes all requests, e.g. http://some.host.com/svc/endpoint hit the service with /endpoint instead of /svc/endpoint

How can I effectively do the same with Istio's ingress controller?

The Route rules object can handle rewrites, but is only available as a per destination manner, i.e. I have to create a route rule for every service.

Upvotes: 0

Views: 2136

Answers (1)

Tautology
Tautology

Reputation: 385

You are right. You need a route rule per service to do setup the rewrite targets. See https://istio.io/docs/reference/config/traffic-rules/routing-rules.html#httprewrite for an example.

Upvotes: 2

Related Questions