
云原生
利用kurise做日志采集使用promtail做sidecar采集日志
利用OpenKurise中的kruise做日志采集,原来我使用的是filebeat作为sidecar采集日志的,虽然采集没有什么问题,但是通过es进才看日志就比较繁琐了,这次实验p
| 当前url | 被请求页面url | 是否跨域 | 原因 |
| http://www.wulaoer.org/ | http://www.wulaoer.org/index.html | 否 | 同源(协议、域名、端口号相同) |
| http://www.wulaoer.org/ | https://www.wulaoer.org/index.html | 是 | 协议不同(http/https) |
| http://www.wulaoer.org/ | http://www.baidu.com/ | 是 | 主域名不同(wulaoer/baidu) |
| http://www.wulaoer.org/ | http://wiki.wulaoer.org/ | 是 | 子域名不同(www/wiki |
| http://www.wulaoer.org:8080/ | http://www.wulaoer.org:9090/ | 是 | 端口号不同(8080/9090) |
location / {
if ($http_origin ~* (*)) { //也可以指定域名
set $cors "true";
}
if ($request_method = 'OPTIONS') {
set $cors "${cors}options";
}
if ($request_method = 'GET') {
set $cors "${cors}get";
}
if ($request_method = 'POST') {
set $cors "${cors}post";
}
if ($cors = "true") {
# Catch all incase there's a request method we're not dealing with properly
add_header 'Access-Control-Allow-Origin' "$http_origin";
}
if ($cors = "trueget") {
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
}
我这里没有指域名,就是所有,下面看一下ingress中配置的域名
kubectl edit ingress -n 命名空间 ingress名称
.........................
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/cors-allow-headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,app_key,storeToken,Referer
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"
creationTimestamp: "2021-10-27T14:38:01Z"
.........................
判断是否是跨域可以参考上面的,有写是跨域有些不能称之为跨域。没有了,就这么多吧。。。。
评论 0