Menghapus garis miring ganda dari permintaan

Masalah: garis miring ganda dalam permintaan dapat menyebabkan permintaan tidak diselesaikan

Setiap permintaan yang berisi dua (atau lebih) garis miring berturut-turut dapat menyebabkan error 404. Misalnya /hello//world/. Masalah dalam contoh ini adalah "//" antara hello dan world.

Solusi: filter untuk garis miring ganda

Terapkan konfigurasi ke ingress Istio Anda untuk memfilter garis miring ganda dalam permintaan dan menggantinya.

  1. Buat file konfigurasi baru bernama apigee-merge-slash-filter.yaml.
  2. Tempel konten berikut ke dalam file:
    apiVersion: networking.istio.io/v1alpha3
    kind: EnvoyFilter
    metadata:
      name: apigee-merge-slashes
      namespace: istio-system
    spec:
      workloadSelector:
        labels:
          app: istio-ingressgateway
      configPatches:
      - applyTo: NETWORK_FILTER # http connection manager is a filter in Envoy
        match:
          context: GATEWAY
          listener:
            filterChain:
              filter:
                name: "envoy.http_connection_manager"
        patch:
          operation: MERGE
          value:
            typed_config:
              "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager"
              merge_slashes: true
  3. Terapkan konfigurasi dengan perintah berikut:
    kubectl apply -f apigee-merge-slash-filter.yaml