在使用 k8s 时如果使用了 ingress-nginx 来作为网关,通常又需要转发 headers,这个时候需要在 configMap 中配置如下内容实现 header 的转发:
YML
apiVersion: v1
data:
allow-snippet-annotations: "true"
enable-real-ip: "true"
compute-full-forwarded-for: "true"
use-forwarded-headers: "true"
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.7.1
name: ingress-nginx-controller
namespace: ingress-nginx就需要增加 use-forwarded-headers: "true" 就可以实现转发 header 了。
这里附上官方解释:
use-forwarded-headers
If true, NGINX passes the incoming
X-Forwarded-*headers to upstreams. Use this option when NGINX is behind another L7 proxy / load balancer that is setting these headers.If false, NGINX ignores incoming
X-Forwarded-*headers, filling them with the request information it sees. Use this option if NGINX is exposed directly to the internet, or it's behind a L3/packet-based load balancer that doesn't alter the source IP in the packets.
推荐阅读
PVE 安装 (基于最新PVE8)及相关基础配置(换 Debian 源和 PVE 企业源)本文介绍 PVE 8 的安装及 Debian 源的更换和 PVE 源的更换
Fake Location 1.3.2.2 全功能解锁模块FakeLocation 1.3.2.2 全功能破解,来自52PoJie论坛
Fake Location 1.3.2.2专业版破解(虚拟定位软件)在 52Pojie 上看到的 Fake Location 的破解案例,虽然 APP 已经不能用了,但是破解参考价值还是很好的
OpenWRT 配置 AP 模式OpenWRT 配置 AP 模式
OpenWrt 进阶教程之无线中继配置指南OpenWrt进阶教程之无线中继配置指南
Android逆向 | 某麦网APP抢票接口加密参数分析及抢票工具编写Android逆向 | 某麦网APP抢票接口加密参数分析及抢票工具编写
OpenWRT 主路由模式和旁路由模式配置OpenWRT 主路由模式和旁路由模式配置
PVE 安装 OpenWRT (基于PVE 8)PVE 安装 OpenWRT(基于PVE 8.0
评论交流
暂无评论,欢迎分享您的见解
