I am just trying to proxy pass from Nginx to Docker Minio service; however, with my current nginx config file, it's not working as expected and keeps loading when I browse any Minio buckets from the Minio console (web interface). Note that the minio server is working fine when it is browsed from local network. The current nginx config file for the minio docker service is as follows:
Nginx config file:
server {
listen 80;
listen [::]:80;
server_name s3.mysite.com;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name s3.mysite.com;
ssl_certificate /etc/letsencrypt/live/s3.mysite.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/s3.mysite.com/privkey.pem;
# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 0;
# To disable buffering
proxy_buffering off;
# Proxy requests to the bucket "photos" to MinIO server running on port 9000
location /blog/ {
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 Host $http_host;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://minio:9000;
}
location / {
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 Host $http_host;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://minio:9001;
}
}
Docker compose file:
minio:
image: minio/minio
ports:
- "9000:9000"
- "9001:9001"
volumes:
- ../s3-bucket:/data
env_file:
- config/.env.minio.prod
command: server /data --console-address :9001
Error from the internet browser:
Firefox can’t establish a connection to the server at wss://s3.mysite.com/ws/objectManager. BrowserHandler.tsx:105:14
Error in websocket connection. Attempting reconnection... BrowserHandler.tsx:140:12
Websocket Disconnected. Attempting Reconnection... BrowserHandler.tsx:132:12
Websocket not available. BrowserHandler.tsx:126:14
Websocket not available.
I think there is something missing in the Nginx config file to reach both ports on Docker service. What I understand port 9001
is used for the console functionallity and port 9000
for data handling. But not sure how to proxy pass to both ports appropriately.