Istio使节正在删除带有主机标头的请求 [英] Istio envoy is dropping requests with Host header

查看:133
本文介绍了Istio使节正在删除带有主机标头的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试让Istio在群集上工作时遇到问题.我的基础架构如下:

I having an issue trying to get Istio working on my cluster. My infrastructure looks like this:

我有一个Magento商店,上面有一个清漆作为前缓存.在安装istio之前,它一直在工作.我已经启用了特使注入. Varnish部署在Pod中,并具有自己的服务重定向,未缓存到magento服务.

I have a Magento Store with a varnish as front cache. It was working before istio installation. I have already enabled envoy injection. Varnish is deployed in a pod and has its own service redirects uncached to magento service.

当我尝试从清漆卷曲到magento时,问题就来了.

The problem comes when I try to curl from varnish to magento.

如果我从清漆卷曲magento服务,我将重定向到magento URL(这是预期的行为)

If I curl magento service from varnish I get a redirect to magento URL (which is the expected behavior)

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

但是当我尝试同样的方法但是使用Host标头跳过magento重定向时,我得到了404:

But when I try the same but using a Host header to skip magento redirection I got a 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

我检查了日志,并请求主机标头从未到达magento服务(在我的示例中为store-es).当我检查清漆特使的日志时,它返回的是404:

I have checked logs and requests whit Host header are never arriving to magento service (store-es in my example). And when I check varnish envoy's log is the one which is returning a 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

您知道为什么会这样吗?为什么主机标头在不请求magento服务的情况下返回404?

Do you know why is this happening? Why host header is returning a 404 without requesting magento service?

我还想提到magento在没有清漆的情况下工作,并且能够连接到Redis(在同一群集中)和mysql(外部群集),所以我放弃了magento的麻烦.

I also want to mention that magento is working without varnish and it's able to connect to redis (in the same cluster) and mysql (outside cluster) so I have discarded a magento's trouble.

推荐答案

我遇到一个类似的问题,即主机标头打入特使是一个与内部服务条目名称不匹配的外部域(永远不会).因为它不匹配,所以它得到了404,我认为必须有一种使用VirtualService进行配置的方法,但不确定如何.

I have a similar issue where the Host header hitting envoy is an external domain which does not match the internal service entry name (it never would). As it does not match it gets a 404, I think there must be a way to configure this with VirtualService but not sure how yet.

这篇关于Istio使节正在删除带有主机标头的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆