I am running a MinIO multi-server instance behind an Nginx proxy server.
For the MinIO integration, I have had trouble integrating, and today I found that I have to set ‘S3 CDN URL’ not as ‘cdn.example.com’, but as ‘cdn.example.com/bucket_name’ to display uploaded images.
Might be due to my own MinIO setting issue, so let me give you a bit more information here.
I have two servers running MinIO for the same contents. Both are mapped with internal IP, like 192.168.1.1 and 192.168.1.2. API access port is say 9000, and Console access port is 9001. (Although I use different IPs and Ports, but for the illustration purpose.)
I had trouble with ‘S3 endpoint’ initially.
With ‘https://cdn.example.com’ as the endpoint, I kept getting errors. I also have tried with console access, like ‘s3.example.com’, the URL that I use to distribute traffic at the Nginx proxy server level for console. Neither of them worked.
Today, I changed the endpoint to ‘http://192.168.1.1:9000’, like I do with NextCloud. (I had similar issues with NextCloud). Finally, I could see that files are uploaded to S3. But, I still was not able to see the image on Discourse. When I checked the blank image’s URL, it was like ‘cdn.example.com/original/1x/…’ In other words, it missed S3 bucket name that I added to the setting.
So, I changed ‘S3 CDN URL’ to ‘https://cdn.example.com/my_bucket_name’. I finally can see the image on Discourse topic edit as well as the live website.
Since it is working, I was going to step down and go back to my other websites, but then, I can see that ‘S3 Backup Bucket’ has to be a different bucket name from the main upload bucket. If I enable ‘Use CDN URL for all the files uploaded to s3 instead of only for images’, what happens to S3 backup? Will it upload the backup file to ‘https://cdn.example.com/backup_bucket’?
So I have tried to run a backup. As expected, I got the error msg for backup.
For now, unless I mis-configured MinIO and/or Discourse, I think it makes sense that ‘S3 CDN URL’ should append main upload bucket name and backup bucket name. Then, I can go back from ‘https://cdn.example.com/my_bucket_name’ to ‘https://cdn.example.com’.
Besides, I prefer not to use internal IP as the ‘S3 endpoint’. I asked the same question to Nextcloud. How does the Discourse’s S3 module work? Just wonder why I have to give full internal IP + Port instead of FQDN that I have assigned at the proxy server level. The FQDN surely helps me to redirect traffic if one of the MinIO servers fails. With current setting, if the main backend server breaks down, read may work (by CDN), but not write actions.