如何给 K8S Nginx Ingress 添加 proxy_set_header 配置

2020-01-29 19:52发布

在 Kubernetes 集群上部署了 Nginx Ingress Controller ,请问如何如何给 Nginx 添加下面的配置?

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

标签: k8s nginx
1条回答
我只想做你的唯一
2楼-- · 2020-01-29 20:32

可以通过 ingress 的 nginx.org/location-snippets 注解添加

apiVersion: extensions/v1beta1 
kind: Ingress
metadata:
  name: cnblogs-ingress
  annotations:
    nginx.org/location-snippets: |
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
查看更多
登录 后发表回答