From 45d165749fa0af43bee7420b730d8f0ecdc986e9 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 8 Apr 2026 16:06:38 -0400 Subject: [PATCH] Fix CORS issues when using minio in development (#2814) Move MinIO from minio.localhost to minio.fizzy.localhost, which makes it same-site with the app, so the CORS redirect succeeds. The service worker fetches Active Storage URLs with `mode: "cors"` so it can inspect response sizes for offline caching. Active Storage's redirect controller returns a 302 to the MinIO presigned URL. When that redirect crosses site boundaries (from fizzy.localhost to minio.localhost), the browser sets the Origin header to "null" on the redirected request per the Fetch spec, which fails the CORS check and produces net::ERR_FAILED. --- config/environments/development.rb | 4 ++-- config/storage.oss.yml | 2 +- saas/config/storage.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 05dc335c2..afa223ced 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -34,8 +34,8 @@ Rails.application.configure do # Store uploaded files on the local file system (see config/storage.yml for options). if Rails.root.join("tmp/minio-dev.txt").exist? config.active_storage.service = :devminio - config.x.content_security_policy.connect_src = "http://minio.localhost:39000" - config.x.content_security_policy.img_src = "http://minio.localhost:39000" + config.x.content_security_policy.connect_src = "http://minio.fizzy.localhost:39000" + config.x.content_security_policy.img_src = "http://minio.fizzy.localhost:39000" else config.active_storage.service = :local end diff --git a/config/storage.oss.yml b/config/storage.oss.yml index 37052e6c5..fb6f2841a 100644 --- a/config/storage.oss.yml +++ b/config/storage.oss.yml @@ -9,7 +9,7 @@ local: devminio: service: S3 bucket: fizzy-dev-activestorage - endpoint: "http://minio.localhost:39000" + endpoint: "http://minio.fizzy.localhost:39000" force_path_style: true request_checksum_calculation: when_required # default is when_supported with CRC64NVME checksum which FlashBlade doesn't support response_checksum_validation: when_required # default is when_supported with CRC64NVME checksum which FlashBlade doesn't support diff --git a/saas/config/storage.yml b/saas/config/storage.yml index a149ccf7b..3825e95be 100644 --- a/saas/config/storage.yml +++ b/saas/config/storage.yml @@ -9,7 +9,7 @@ local: devminio: service: S3 bucket: fizzy-dev-activestorage - endpoint: "http://minio.localhost:39000" + endpoint: "http://minio.fizzy.localhost:39000" force_path_style: true request_checksum_calculation: when_required # default is when_supported with CRC64NVME checksum which FlashBlade doesn't support response_checksum_validation: when_required # default is when_supported with CRC64NVME checksum which FlashBlade doesn't support