fanxing3.conf 1.68 KB
upstream gateway {
  server 127.0.0.1:30000;
}
server {
    listen 30010;
    server_name localhost;

    client_max_body_size 10G;

    location / {
        alias /data/page/dist/;
        index index.html;
    }

    location /srs/ {
        rewrite ^/srs/(.*) /$1 break;
        proxy_pass  http://127.0.0.1:18080;
    }

    location /api/ {
        rewrite ^/api/(.*) /$1 break;
        proxy_pass http://gateway;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    location /api/video-server/ {
        rewrite ^/api/video-server/(.*) /$1 break;
        add_header Access-Control-Allow-Methods '*';
        add_header Access-Control-Allow-Headers 'Origin, X-Requested-With, Content-Type, Accept, Authorization';
        proxy_pass http://127.0.0.1:10350/;
    }

    location /api/video-cloud/ {
        rewrite ^/api/video-cloud/(.*) /$1 break;
        proxy_pass http://127.0.0.1:8888/;
    }

    location /api/images {
        if ($request_uri ~* "\.\.\/|\.\/"){
                return 500;
        }
        alias /images;
    }

    location /api/agent/ {
        rewrite ^/api/agent/(.*) /v1/agent/$1 break;
        proxy_pass http://127.0.0.1:8500/;
        if ( $request_method = 'OPTIONS' ) {
                return 200;
        }
    }

    location /api/prometheus/ {
        rewrite ^/api/prometheus/(.*) /api/v1/$1 break;
        proxy_pass http://192.168.9.233:9090/;
        if ( $request_method = 'OPTIONS' ) {
                return 200;
        }
    }
}