日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

【Path Redirect】請(qǐng)求路徑重定向

配置請(qǐng)求路徑重定向可以使得發(fā)往服務(wù)的指定請(qǐng)求獲得HTTP 301重定向響應(yīng),將請(qǐng)求重定向到服務(wù)的其它路徑上。本文介紹如何配置請(qǐng)求路徑重定向。

前提條件

已完成準(zhǔn)備工作,并部署httpbin服務(wù)和sleep服務(wù)。具體操作,請(qǐng)參見(jiàn)準(zhǔn)備工作。

操作步驟

  1. 使用istioctl工具,執(zhí)行以下命令,為httpbin服務(wù)部署Waypoint代理。

    istioctl x waypoint apply --service-account httpbin

    預(yù)期輸出:

    waypoint default/httpbin applied
  2. 為httpbin服務(wù)配置虛擬服務(wù),將發(fā)往httpbin服務(wù)根路徑的請(qǐng)求轉(zhuǎn)發(fā)至/get路徑。

    1. 登錄ASM控制臺(tái),在左側(cè)導(dǎo)航欄,選擇服務(wù)網(wǎng)格 > 網(wǎng)格管理。

    2. 網(wǎng)格管理頁(yè)面,單擊目標(biāo)實(shí)例名稱(chēng),然后在左側(cè)導(dǎo)航欄,選擇流量管理中心 > 虛擬服務(wù),然后單擊創(chuàng)建。

    3. 創(chuàng)建頁(yè)面,進(jìn)行如下配置,單擊預(yù)覽,確認(rèn)YAML內(nèi)容無(wú)誤后,單擊確認(rèn),然后單擊創(chuàng)建

      image.png

      展開(kāi)查看預(yù)覽YAML

      apiVersion: networking.istio.io/v1beta1
      kind: VirtualService
      metadata:
        name: httpbin
        namespace: default
      spec:
        hosts:
          - httpbin.default.svc.cluster.local
        http:
          - match:
              - uri:
                  exact: /
            redirect:
              uri: /get
  3. 執(zhí)行以下命令,驗(yàn)證請(qǐng)求路徑重定向是否生效。

    kubectl exec -it deploy/sleep -- curl httpbin:8000 -I

    預(yù)期輸出:

    HTTP/1.1 301 Moved Permanently
    location: http://httpbin:8000/get
    date: xxx, xx Aug 2023 11:xx:xx GMT
    server: istio-envoy
    transfer-encoding: chunked

    可以看到在sleep容器內(nèi)部訪(fǎng)問(wèn)httpbin服務(wù)的根路徑,返回301響應(yīng),其中location字段為http://httpbin:8000/get,表示請(qǐng)求被重定向到httpbin服務(wù)的/get路徑。