123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- server {
- listen 80;
- server_name observe-front.cestong.com.cn ui.test.obs.js.sgcc.com.cn ui.obs.js.sgcc.com.cn;
- location / {
- if ($request_uri ~* .*[.](js|css|map|jpg|png|svg|ico)$) {
- # 除非浏览器选择禁用缓存,否则在max-age区间内,不会重新发起请求,即使服务器上的数据已经变化
- add_header Cache-Control "public, max-age=2592000";
- # 浏览器依然会缓存,只是浏览器在使用缓存前需要向服务端确认缓存是否有效(请求头携带If-None-Match, If-Modified-Since),有效则304, 否则返回最新数据;
- # 如果浏览器选择禁用缓存(请求头中带Cache-Control: no-cache, 服务器会返回最新数据)
- # add_header Cache-Control "no-cache";
- }
- root /usr/share/nginx/html;
- index index.html index.htm;
- }
- location /col {
- add_header 'Access-Control-Allow-Origin' $allow_origin;
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS';
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Referer,Referrer-Policy';
- add_header 'Access-Control-Max-Age' '1728000';
- if ($request_method = 'OPTIONS') {
- return 204;
- }
- proxy_pass http://otel-collector-opentelemetry-collector.observe.svc.cluster.local:4318;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $host;
- rewrite ^/col/(.*)$ /$1 break;
- }
- location /re/api/v1/metrics {
- return 404;
- }
- location /re {
- if ($request_method = 'OPTIONS') {
- return 204;
- }
- proxy_pass http://ob-server.observe.svc.cluster.local;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $host;
- rewrite ^/re/(.*)$ /$1 break;
- }
- location /core {
- add_header 'Access-Control-Allow-Origin' '*' always;
- add_header 'Access-Control-Allow-Credentials' 'true' always;
- add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS' always;
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Referer,Referrer-Policy, Authorization' always;
- add_header 'Access-Control-Max-Age' '1728000' always;
- if ($request_method = 'OPTIONS') {
- return 204;
- }
- proxy_pass http://ob-core.observe.svc.cluster.local;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $host;
- rewrite ^/core/(.*)$ /$1 break;
- }
- location /api/v1/ws {
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header Cache-Control private;
- 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,Authorization';
- if ($request_method = 'OPTIONS') {
- return 204;
- }
- proxy_pass http://ob-server.observe.svc.cluster.local;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $host;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $connection_upgrade;
- }
- # location /app {
- # if ($request_method = 'OPTIONS') {
- # return 204;
- # }
- # proxy_pass http://deepflow-app.deepflow.svc.cluster.local:20418;
- # proxy_set_header X-Real-IP $remote_addr;
- # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- # proxy_set_header Host $host;
- # rewrite ^/app/(.*)$ /$1 break;
- #
- # }
- location /ui/api {
- if ($request_method = 'OPTIONS') {
- return 204;
- }
- return 202;
- }
- }
|