upstream  demo_k8s_cluster {
    ip_hash;
    server 192.168.35.45:30500;
    server 192.168.34.247:30500;
    server 192.168.34.248:30500;
    server 192.168.34.234:30500;
    server 192.168.34.238:30500;
}
#server {
#    listen 18000 ssl;
#    include /etc/nginx/conf.d/ssl_settings/ssl-x-demo-uavcmlc.conf;
#    server_name demo.uavcmlc.com;
#    rewrite ^(.*)$ https://www.demo.uavcmlc.com:18000$1 permanent;
#    error_page 497 301 https://www.demo.uavcmlc.com:18000$1;
#}
server {
    listen 18000 ssl default_server;
    listen 443   ssl default_server;
    include /etc/nginx/conf.d/ssl_settings/ssl-x-demo-uavcmlc.conf;
    include /etc/nginx/conf.d/ssl_settings/error.conf;
    server_name  _ www.demo.uavcmlc.com ;
    deny 117.173.25.92;

    #add_header X-Xss-Protection 1;
    #add_header X-Xss-Protection "mod=block";
    #add_header X-Content-Type-Options "nosniff";
    #add_header Content-Security-Policy "'default-src' 'self'";
    #add_header strict-transport-security "max-age=31536000; includeSubDomains; preload";
    #add_header Referrer-Policy  "strict-origin-when-cross-origin";
    #add_header X-Permitted-Cross-Domain-Policies all;
    #add_header X-Download-Options "noopen" always;
    #add_header X-Frame-Options "DENY";

    location /MP_verify_iJt8t97EPTfpp7gN.txt {
        alias /MP/MP_verify_iJt8t97EPTfpp7gN.txt;
    }
    location /inner/ {
        #allow 183.220.149.19/32;
        allow 192.168.0.0/16;
        deny all;

        client_max_body_size 5120m;
        client_body_buffer_size 5120m;
        client_body_timeout 6000s;
        proxy_send_timeout 10000s;
        proxy_read_timeout 10000s;
        proxy_connect_timeout 600s;
        proxy_max_temp_file_size 5120m;
        proxy_request_buffering on;
        proxy_buffering off;
        proxy_buffer_size 4k;
        proxy_buffers 4 12k;
        proxy_set_header Host 'www.demo.uavcmlc.com';
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_pass http://192.168.34.234:39745/;
    }

   location /oms/api/ {
        proxy_pass http://192.168.34.234:39888/;
        client_max_body_size 5120m;
        client_body_buffer_size 5120m;
        client_body_timeout 6000s;
        proxy_send_timeout 10000s;
        proxy_read_timeout 10000s;
        proxy_connect_timeout 600s;
        proxy_max_temp_file_size 5120m;
        proxy_request_buffering on;
        proxy_buffering off;
        proxy_buffer_size 4k;
        proxy_buffers 4 12k;
        proxy_set_header Host 'www.demo.uavcmlc.com';
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        allow 183.220.149.19;
        allow 192.168.0.0/16;
        deny all;
    }
   location /oms/ {
        proxy_pass http://192.168.34.234:39528/;
        client_max_body_size 5120m;
        client_body_buffer_size 5120m;
        client_body_timeout 6000s;
        proxy_send_timeout 10000s;
        proxy_read_timeout 10000s;
        proxy_connect_timeout 600s;
        proxy_max_temp_file_size 5120m;
        proxy_request_buffering on;
        proxy_buffering off;
        proxy_buffer_size 4k;
        proxy_buffers 4 12k;
        proxy_set_header Host 'www.demo.uavcmlc.com';
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        allow 183.220.149.19;
        allow 192.168.0.0/16;
        deny all;
    }


    location / {
        sub_filter        'demo.uavcmlc.com:18000'   'demo.uavcmlc.com:443';
        sub_filter_once    off;
        sub_filter_types   application/vnd.apple.mpegurl;

        proxy_pass http://demo_k8s_cluster/;
        client_max_body_size 5120m;
        client_body_buffer_size 5120m;
        client_body_timeout 6000s;
        proxy_send_timeout 10000s;
        proxy_read_timeout 10000s;
        proxy_connect_timeout 600s;
        proxy_max_temp_file_size 5120m;
        proxy_request_buffering on;
        proxy_buffering off;
        proxy_buffer_size 4k;
        proxy_buffers 4 12k;
        proxy_set_header Host 'www.demo.uavcmlc.com';
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
#    location /api/mqtts/ {
#        proxy_pass http://cmii-uav-mqtthandler.uavcloud-demo.io:30500/uav/uavInfo/;
#    }

#    location /api/mqtt_wss/ {
#        #通过配置端口指向部署websocker的项目
#        proxy_pass http://192.168.34.234:54544/mqtt;
#        proxy_set_header Sec-WebSocket-Protocol mqtt;
#        proxy_http_version 1.1;
#        proxy_set_header Upgrade $http_upgrade;
#        proxy_set_header Connection "Upgrade";
#        proxy_set_header X-real-ip $remote_addr;
#        proxy_set_header X-Forwarded-For $remote_addr;
#    }
    #location /_AMapService/v4/map/styles {
    #    set $args "$args&jscode=cf66cea95bdcdfcf8048456b36f357a1";
    #    proxy_pass https://webapi.amap.com/v4/ap/styles;
    #}
    #location  /_AMapService/v3/log/ {
    #    deny all;
    #}
    #location /_AMapService/ {
    #    set $args "$args&jscode=cf66cea95bdcdfcf8048456b36f357a1";
    #    proxy_pass https://restapi.amap.com/;
    #}
#    location /api/cloudLive/public/video/playback/manage/playM3u8 {
#        proxy_hide_header Content-type;
#        add_header Content-Type application/vnd.apple.mpegurl;
#        #proxy_set_header Content-Type application/vnd.apple.mpegurl;
#        proxy_set_header Host $host;
#        proxy_pass http://demo_k8s_cluster/api/cloudLive/public/video/playback/manage/playM3u8;
#    }


    location ~ ^/.*/(actuator|swagger-resources|api-docs|env|ping|health)(/|$) {
        return 403;
    }

    location /rtc/v1/ {
        proxy_set_header Host 'helm-live.ig-demo.uavcmlc.com';
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://demo_k8s_cluster/rtc/v1/;
    }
}

server {
    listen 18000 ssl;
    listen 443   ssl;
    include /etc/nginx/conf.d/ssl_settings/ssl-x-demo-uavcmlc.conf;
    include /etc/nginx/conf.d/ssl_settings/error.conf;
    server_name live.demo.uavcmlc.com;

    location / {
        proxy_set_header Host 'helm-live.ig-demo.uavcmlc.com';
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://demo_k8s_cluster;
    }
    #location /rtc/v1/ {
    #    proxy_pass http://192.168.34.236:35985/rtc/v1/;
    #}
    location /v2/models/GroundingDINO/infer {
        proxy_pass http://192.168.34.227:39900/v2/models/GroundingDINO/infer;
    }
}
