问题描述
由于某些依赖于Host标头才能正常运行的旧版应用程序,我需要拥有一个Ingress(代理等),它能够重写Host标头并将其传递给下游(后端).是否有任何支持此功能的Ingress Controller?
Due to some legacy application that relies on Host header to function correctly, I need to have an Ingress (proxy, etc) that capable of rewrite Host header and pass that to downstream (backend). Is there any Ingress Controller that supports this functionality?
示例:
最终用户通过foo.com/a
进入后端a
并通过foo.com/b
进入后端b
进入我们的网站.但是,由于a
和b
是旧版应用,因此它仅接受:
End user access our website through foo.com/a
for backend a
and foo.com/b
for backend b
. But since a
and b
are legacy app, it only accept:
-
a
在Host: a.foo.com
时接受连接 -
b
在Host: b.foo.com
时接受连接
a
accepts connection whenHost: a.foo.com
b
accepts connection whenHost: b.foo.com
推荐答案
这可以使用以下注释来完成:nginx.ingress.kubernetes.io/upstream-vhost: host.example.com
This can be done using this annotation: nginx.ingress.kubernetes.io/upstream-vhost: host.example.com
这篇关于是否可以在k8s Ingress Controller中重写HOST标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!