当前位置: 首页 > 工具软件 > nginx-token > 使用案例 >

nginx-ingress配置跨域

柴茂材
2023-12-01

nginx-ingress-controller
配置跨域:(直接在ingress 的annation里面加)

kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/cors-allow-credentials: true
nginx.ingress.kubernetes.io/cors-allow-headers: DNT,web-token,app-token,Authorization,Accept,Origin,Keep-Alive,User-Agent,X-Mx-ReqToken,X-Data-Type,X-Auth-Token,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,token,Cookie
nginx.ingress.kubernetes.io/cors-allow-methods: PUT, GET, POST, OPTIONS
nginx.ingress.kubernetes.io/cors-allow-origin: *
nginx.ingress.kubernetes.io/enable-cors: true
nginx.ingress.kubernetes.io/Access-Control-Allow-Origin: *
nginx.ingress.kubernetes.io/proxy-body-size: 300m

上传大小配置:

proxy-body-size: 300m

获取真实ip配置:

compute-full-forwarded-for:true
forwarded-for-header:X-Forwarded-For
use-forwarded-headers:true

开启gzip压缩:

use-gzip true
gzip-level 5
gzip-types *

 类似资料: