obf.conf 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. server {
  2. listen 80;
  3. server_name observe-front.cestong.com.cn ui.test.obs.js.sgcc.com.cn ui.obs.js.sgcc.com.cn;
  4. location / {
  5. if ($request_uri ~* .*[.](js|css|map|jpg|png|svg|ico)$) {
  6. # 除非浏览器选择禁用缓存,否则在max-age区间内,不会重新发起请求,即使服务器上的数据已经变化
  7. add_header Cache-Control "public, max-age=2592000";
  8. # 浏览器依然会缓存,只是浏览器在使用缓存前需要向服务端确认缓存是否有效(请求头携带If-None-Match, If-Modified-Since),有效则304, 否则返回最新数据;
  9. # 如果浏览器选择禁用缓存(请求头中带Cache-Control: no-cache, 服务器会返回最新数据)
  10. # add_header Cache-Control "no-cache";
  11. }
  12. root /usr/share/nginx/html;
  13. index index.html index.htm;
  14. }
  15. location /col {
  16. add_header 'Access-Control-Allow-Origin' $allow_origin;
  17. add_header 'Access-Control-Allow-Credentials' 'true';
  18. add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS';
  19. 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';
  20. add_header 'Access-Control-Max-Age' '1728000';
  21. if ($request_method = 'OPTIONS') {
  22. return 204;
  23. }
  24. proxy_pass http://otel-collector-opentelemetry-collector.observe.svc.cluster.local:4318;
  25. proxy_set_header X-Real-IP $remote_addr;
  26. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  27. proxy_set_header Host $host;
  28. rewrite ^/col/(.*)$ /$1 break;
  29. }
  30. location /re/api/v1/metrics {
  31. return 404;
  32. }
  33. location /re {
  34. if ($request_method = 'OPTIONS') {
  35. return 204;
  36. }
  37. proxy_pass http://ob-server.observe.svc.cluster.local;
  38. proxy_set_header X-Real-IP $remote_addr;
  39. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  40. proxy_set_header Host $host;
  41. rewrite ^/re/(.*)$ /$1 break;
  42. }
  43. location /core {
  44. add_header 'Access-Control-Allow-Origin' '*' always;
  45. add_header 'Access-Control-Allow-Credentials' 'true' always;
  46. add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, DELETE, PATCH, OPTIONS' always;
  47. 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;
  48. add_header 'Access-Control-Max-Age' '1728000' always;
  49. if ($request_method = 'OPTIONS') {
  50. return 204;
  51. }
  52. proxy_pass http://ob-core.observe.svc.cluster.local;
  53. proxy_set_header X-Real-IP $remote_addr;
  54. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  55. proxy_set_header Host $host;
  56. rewrite ^/core/(.*)$ /$1 break;
  57. }
  58. location /api/v1/ws {
  59. add_header 'Access-Control-Allow-Origin' '*';
  60. add_header 'Access-Control-Allow-Credentials' 'true';
  61. add_header Cache-Control private;
  62. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  63. 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';
  64. if ($request_method = 'OPTIONS') {
  65. return 204;
  66. }
  67. proxy_pass http://ob-server.observe.svc.cluster.local;
  68. proxy_set_header X-Real-IP $remote_addr;
  69. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  70. proxy_set_header Host $host;
  71. proxy_set_header Upgrade $http_upgrade;
  72. proxy_set_header Connection $connection_upgrade;
  73. }
  74. # location /app {
  75. # if ($request_method = 'OPTIONS') {
  76. # return 204;
  77. # }
  78. # proxy_pass http://deepflow-app.deepflow.svc.cluster.local:20418;
  79. # proxy_set_header X-Real-IP $remote_addr;
  80. # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  81. # proxy_set_header Host $host;
  82. # rewrite ^/app/(.*)$ /$1 break;
  83. #
  84. # }
  85. location /ui/api {
  86. if ($request_method = 'OPTIONS') {
  87. return 204;
  88. }
  89. return 202;
  90. }
  91. }