And*_*esJ 5 curl virtualhost kubernetes envoyproxy
我在尝试让 Istio 在我的集群上运行时遇到问题。我的基础设施如下所示:
我有一个 Magento 商店,用清漆作为前端缓存。它在安装 istio 之前就可以工作。我已经启用了特使注入。Varnish 部署在 pod 中,并且有自己的服务未缓存重定向到 magento 服务。
当我尝试从 varnish 卷曲到 magento 时,问题就出现了。
如果我从 varnish 卷曲 magento 服务,我会重定向到 magento URL(这是预期的行为)
root@varnish-6468d5958d-dvxhx:/# curl -v store-es
* Rebuilt URL to: store-es/
* Trying 10.32.97.229...
* TCP_NODELAY set
* Connected to store-es (10.32.97.229) port 80 (#0)
> GET / HTTP/1.1
> Host: store-es
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< server: envoy
< date: Wed, 07 Nov 2018 11:08:47 GMT
< content-type: text/html
< content-length: 185
< location: https://store-sta.xxxxx.yyy/
< myheader: store-es-6484d46d66-952xj
< x-envoy-upstream-service-time: 4
<
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.13.8</center>
</body>
</html>
* Curl_http_done: called premature == 0
* Connection #0 to host store-es left intact
Run Code Online (Sandbox Code Playgroud)
但是当我尝试相同但使用 Host header 来跳过 magento 重定向时,我得到了 404:
root@varnish-6468d5958d-dvxhx:/# curl -v -H "Host: store-sta.xxxxx.yyy" store-es
* Rebuilt URL to: store-es/
* Trying 10.32.97.229...
* TCP_NODELAY set
* Connected to store-es (10.32.97.229) port 80 (#0)
> GET / HTTP/1.1
> Host: store-sta.xxxxx.yyy
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< date: Wed, 07 Nov 2018 11:11:59 GMT
< server: envoy
< content-length: 0
<
* Curl_http_done: called premature == 0
* Connection #0 to host store-es left intact
Run Code Online (Sandbox Code Playgroud)
我已经检查了日志和请求,主机标头永远不会到达magento服务(在我的示例中是store-es)。当我检查 varnish envoy 的日志时,返回的是 404:
[2018-11-07T11:11:50.548Z] "GET /HTTP/1.1" 404 NR 0 0 0 - "-" "curl/7.52.1" "e754b17f-ae2e-4734-beb4-f7a2d6e412da" "store-sta.xxxxx.yyy" "-" - - 10.32.97.229:80 10.32.67.5:45540
Run Code Online (Sandbox Code Playgroud)
你知道为什么会发生这种情况吗?为什么主机头返回 404 而不请求 magento 服务?
我还想提一下,magento 可以在没有 varnish 的情况下工作,并且能够连接到 redis(在同一集群中)和 mysql(在集群之外),所以我已经放弃了 magento 的麻烦。
小智 2
我有一个类似的问题,其中命中 envoy 的主机标头是一个外部域,它与内部服务条目名称不匹配(它永远不会)。由于它不匹配,它得到了 404,我认为必须有一种方法可以使用 VirtualService 来配置它,但还不确定如何配置。
| 归档时间: |
|
| 查看次数: |
2051 次 |
| 最近记录: |