istio-ingressgateway无法处理完整的URL请求

时间:2018-08-11 16:30:03

标签: istio

环境

Kubernetes

我成功配置了Istio,网关(具有TLS和tls.httpsRedirect设置),VirtualService,并且可以接收HTTP POST。

这是向我的服务请求的原始http。

POST / HTTP/1.1
Host: myurl.com
Content-Type: application/json
Connection: close
Content-Length: 17
X-Forwarded-Proto: https
X-Forwarded-For: XXX.XXX.XXX.XXX

{"hello":"world"}

上面的示例http可以正常工作。我得到200 OK响应。

但有时我会应要求提供“完整URL”,似乎Istio无法处理

POST https://myurl.com/ HTTP/1.1  <== HERE THE FULL URL
Host: myurl.com
Content-Type: application/json
Connection: close
Content-Length: 17
X-Forwarded-Proto: https
X-Forwarded-For: XXX.XXX.XXX.XXX

{"hello":"world"}

这是istio-ingressgateway的日志。

POST / HTTP/1.1" 200 - 318 203 210 210 "XXX.XXX.XXX.XXX" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36" "eab50f1a-2392-9539-920e-ca43f9be8aae" "myurl.com" "10.42.1.205:5000"

POST https://myurl.com/ HTTP/1.1" 404 NR - - - - "XXX.XXX.XXX.XXX" - - "myurl.com" -

是此错误还是我配置错误。这是我的配置

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
    tls:
      httpsRedirect: true
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
      privateKey: /etc/istio/ingressgateway-certs/tls.key
    hosts:
    - '*'
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-service
spec:
  gateways:
  - "my-gateway"
  hosts:
  - "myurl.com"
  http:
  - route:
    - destination:
        host: my-service.staging.svc.cluster.local
        port:
          number: 80

0 个答案:

没有答案