首页 > 其他分享 >Istio从入门到精通—— 流量治理的原理 —— VirutalService —— HTTPRedirect

Istio从入门到精通—— 流量治理的原理 —— VirutalService —— HTTPRedirect

时间:2023-12-18 17:23:57浏览次数:30  
标签:redirect HTTPRedirect No URL Istio VirutalService port overwrite

流量治理的原理 —— VirutalService —— HTTPRedirect

https://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPRedirect

  HTTPRedirect can be used to send a 301 redirect response to the caller, where the Authority/Host and the URI in the response can be swapped with the specified values. For example, the following rule redirects requests for /v1/getProductRatings API on the ratings service to /v1/bookRatings provided by the bookratings service.

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: ratings-route
spec:
  hosts:
  - ratings.prod.svc.cluster.local
  http:
  - match:
    - uri:
        exact: /v1/getProductRatings
    redirect:
      uri: /v1/bookRatings
      authority: newratings.default.svc.cluster.local
  ...

 

FieldTypeDescriptionRequired
uri string

On a redirect, overwrite the Path portion of the URL with this value. Note that the entire path will be replaced, irrespective of the request URI being matched as an exact path or prefix.

No
authority string

On a redirect, overwrite the Authority/Host portion of the URL with this value.

No
port uint32 (oneof)

On a redirect, overwrite the port portion of the URL with this value.

No
derivePort RedirectPortSelection (oneof)

On a redirect, dynamically set the port:

  • FROM_PROTOCOL_DEFAULT: automatically set to 80 for HTTP and 443 for HTTPS.
  • FROM_REQUEST_PORT: automatically use the port of the request.
No
scheme string

On a redirect, overwrite the scheme portion of the URL with this value. For example, http or https. If unset, the original scheme will be used. If derivePort is set to FROM_PROTOCOL_DEFAULT, this will impact the port used as well

No
redirectCode uint32

On a redirect, Specifies the HTTP status code to use in the redirect response. The default response code is MOVED_PERMANENTLY (301).

No

标签:redirect,HTTPRedirect,No,URL,Istio,VirutalService,port,overwrite
From: https://www.cnblogs.com/zuoyang/p/17911707.html

相关文章