Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Configuring Nginx Reverse Proxy for MinIO Cluster

Tech May 16 1

Environment Setup

A MinIO deployment consisting of three clustered servers requires load balancing through Nginx to enable reverse proxy access.

Location Block Configuration Issue

Symptom:

Accessing https://hcmminio.xxx.com/minio results in a 404 error and browser console shows what appears to be CORS-related issues:

Referrer Policy: strict-origin-when-cross-origin

The actual problem stems from incorrect Nginx configuration rather than cross-origin restrictions. Here's the problematic setup:

http {
    ...
    upstream minioconsole {
        server 192.10.16.203:9001;
        server 192.10.16.204:9001;
        server 192.10.16.210:9001;
    }

    server {
        listen 443 ssl;
        server_name hcmminio.xxx.com;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_certificate      /etc/nginx/ssl/xxx.com.pem;
        ssl_certificate_key  /etc/nginx/ssl/xxx.com.key;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
        
        # Incorrect path mapping - MinIO doesn't expect /minio prefix
        location /minio {
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_set_header   Host             $http_host;
            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_http_version 1.1;
            proxy_pass         http://minioconsole;
        }
    }
}

Solution: Change location /minio to location / to properly route requests to the MinIO console.

WebSocket Connection Problems

Symptom:

When browsing bucket contents over HTTPS, the interface remains stuck on loading screens. Browser developer tools reveal multiple WebSocket connection failures.

This issue occurs specifically with secure connections and relates to WebSocket upgrade handling. Similar problems are documented in referenced technical articles.

Solution: Add WebSocket support headers to the Nginx configuration:

http {
    ...
    upstream minio_cluster_console {
        server 192.10.16.203:9001;
        server 192.10.16.204:9001;
        server 192.10.16.210:9001;
    }

    server {
        listen 443 ssl;
        server_name hcmminio.xxx.com;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_certificate      /etc/nginx/ssl/xxx.com.pem;
        ssl_certificate_key  /etc/nginx/ssl/xxx.com.key;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
        
        location / {
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_set_header   Host             $http_host;
            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_http_version 1.1;
            
            # WebSocket support headers
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            
            proxy_pass         http://minio_cluster_console;
        }
    }
}

Apply changes by reloading Nginx configurasion (nginx -s reload) or restarting the service.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.