Điểm:0

Blocked loading mixed active content

lá cờ pe

I am using react as my font end, and nodejs as backend which is running on localhost:3016 and I used nginx as reverse proxy and load balancer; this my nginx conf file for the site

upstream load_balance{
    #least_conn;
     #ip_hash;
    server  localhost:3016;
    #server localhost:8010;
    #server localhost:8011;
    #server localhost:8012;
    #server localhost:8013;
    #server localhost:8014;
    #server localhost:8015;
    #server localhost:8016;
    #server localhost:8017;
    #server localhost:8018;
}

server {

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;
    # listen [::]:443 ssl ipv6only=on; # managed by Certbot
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/ethiolive.net/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/ethiolive.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


    #root /var/www/html;

    # Add index.php to the list if you are using PHP
    #index index.html index.htm index.nginx-debian.html;

    server_name ethiolive.net www.ethiolive.net;
    
    add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
        add_header 'Access-Control-Allow-Headers' 'X-Requested-With,Accept,Content-Type, Origin,x-auth' always;
        #default_type application/json;
    
    location /api {
        proxy_pass  http://load_balance;
        proxy_http_version  1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host  $host;
        proxy_cache_bypass $http_upgrade;
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        # try_files $uri $uri/ =404;
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
            #
            # Custom headers and headers various browsers *should* be OK with but aren't
            #
            add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
            #
            # Tell client that this pre-flight info is valid for 20 days
            #
            add_header 'Access-Control-Max-Age' 1728000;
            add_header 'Content-Type' 'text/plain; charset=utf-8';
            add_header 'Content-Length' 0;
            return 204;
         }
         if ($request_method = 'POST') {
            add_header 'Access-Control-Allow-Origin' '*' always;
            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
            add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
            add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
         }
         if ($request_method = 'GET') {
            add_header 'Access-Control-Allow-Origin' '*' always;
            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
            add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
            add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
         }
    }
        location / {
        root /var/www/html/LiveStream/LiveStream-frontend/users/build;
        index index.html index.htm;
        }
    location /admin {
        root /var/www/html/LiveStream/LiveStream-frontend/admin/build;      index index.html index.htm;
    }
    location /socket/ {
                proxy_pass http://load_balance/socket.io/;
        proxy_redirect          off;

                proxy_http_version      1.1;

                proxy_set_header        Upgrade                 $http_upgrade;
                proxy_set_header        Connection              "upgrade";
                proxy_set_header        Host                    $host;
                proxy_set_header        X-Real-IP               $remote_addr;
                proxy_set_header        X-Forwarded-For         $proxy_add_x_forwarded_for;
        }               
        location /socket.io/{
        
                proxy_pass http://load_balance/socket.io/;
        proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
               
    }
           ```
I get this error 

2.2664eafa.chunk.js:2 Mixed Content: The page at 'https://www.ethiolive.net/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://192.168.8.101:3016/catagorey/getMainCategorie'. This request has been blocked; the content must be served over HTTPS.``` from chromes console, I think I am missing something on the nginx configuration, thanks

lá cờ in
Định cấu hình nodejs của bạn để tạo các trang có url HTTPS chính xác.
Điểm:0
lá cờ pe

Tôi đã tìm ra giải pháp cho sự cố và tôi tin rằng việc chia sẻ giải pháp sẽ hữu ích cho những người khác, hãy sử dụng 'proxy_set_header Nội dung-Bảo mật-Chính sách nâng cấp-yêu cầu-không an toàn' này; dưới đây là cách tôi cấu hình

vị trí /api {
                proxy_pass http://load_balance;
                proxy_http_version 1.1;
                proxy_set_header Nâng cấp $http_upgrade;
                'nâng cấp' kết nối proxy_set_header;
                proxy_set_header Máy chủ lưu trữ $host;
                proxy_cache_bypass $http_upgrade;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_read_timeout 3600;
                proxy_headers_hash_max_size 512;
                proxy_headers_hash_bucket_size 128;
                proxy_set_header Nâng cấp chính sách bảo mật-nội dung-yêu cầu không an toàn;

hy vọng bạn cảm thấy nó hữu ích!

Đăng câu trả lời

Hầu hết mọi người không hiểu rằng việc đặt nhiều câu hỏi sẽ mở ra cơ hội học hỏi và cải thiện mối quan hệ giữa các cá nhân. Ví dụ, trong các nghiên cứu của Alison, mặc dù mọi người có thể nhớ chính xác có bao nhiêu câu hỏi đã được đặt ra trong các cuộc trò chuyện của họ, nhưng họ không trực giác nhận ra mối liên hệ giữa câu hỏi và sự yêu thích. Qua bốn nghiên cứu, trong đó những người tham gia tự tham gia vào các cuộc trò chuyện hoặc đọc bản ghi lại các cuộc trò chuyện của người khác, mọi người có xu hướng không nhận ra rằng việc đặt câu hỏi sẽ ảnh hưởng—hoặc đã ảnh hưởng—mức độ thân thiện giữa những người đối thoại.