配置微信小程序或公众号认证

annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
location /MP_verify_CwtbVLWfGpMDmrcy.txt {
add_header Content-Type text/plain;
return 200 "CwtbVLWfGpMDmrcy";
}

跨域配置

annotations:
nginx.ingress.kubernetes.io/cors-allow-credentials: 'true'
nginx.ingress.kubernetes.io/cors-allow-headers: >-
DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Forwarded-For,X-CustomHeader,X-Token
nginx.ingress.kubernetes.io/cors-allow-methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
#如果cors-allow-origin不能为*,可写死为对应的域名,也可使用下面的方案
nginx.ingress.kubernetes.io/cors-allow-origin: '*'
nginx.ingress.kubernetes.io/cors-expose-headers: Version, X-CustomResponseHeader
nginx.ingress.kubernetes.io/enable-cors: 'true'

annotations:
nginx.ingress.kubernetes.io/server-snippet: >
if ($http_origin = ''){
set $http_origin "*";
}
add_header Access-Control-Allow-Origin $http_origin;

add_header 'Access-Control-Allow-Credentials' 'true';

add_header 'Access-Control-Allow-Headers'
DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Forwarded-For,X-CustomHeader,X-Token;

add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE,PATCH,OPTIONS';

add_header 'Access-Control-Expose-Headers' 'Version,X-CustomResponseHeader';

proxy_hide_header 'Access-Control-Allow-Origin';

proxy_hide_header 'Access-Control-Allow-Credentials';

常用配置

annotations:    
#http请求不会重定向到https
nginx.ingress.kubernetes.io/proxy-body-size: 10m
#请求允许的最大请求体大小
nginx.ingress.kubernetes.io/ssl-redirect: 'false'
#使用默认的后端返回头
nginx.ingress.kubernetes.io/configuration-snippet: proxy_hide_header none;
#配置超时等信息
nginx.ingress.kubernetes.io/server-snippet: |
client_body_timeout 120s;
client_max_body_size 1024M;
client_header_buffer_size 10k;
proxy_request_buffering off;