是否可以在k8s Ingress Controller中重写HOST标头? [英] Is it possible to rewrite HOST header in k8s Ingress Controller?

查看:121
本文介绍了是否可以在k8s Ingress Controller中重写HOST标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些依赖于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进入我们的网站.但是,由于ab是旧版应用,因此它仅接受:

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:

  • aHost: a.foo.com
  • 时接受连接
  • bHost: b.foo.com
  • 时接受连接
  • a accepts connection when Host: a.foo.com
  • b accepts connection when Host: 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标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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