Skip to content

Fix CORS issues when using minio in development#2814

Merged
flavorjones merged 1 commit intomainfrom
fix-dev-minio
Apr 8, 2026
Merged

Fix CORS issues when using minio in development#2814
flavorjones merged 1 commit intomainfrom
fix-dev-minio

Conversation

@flavorjones
Copy link
Copy Markdown
Member

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.

Copilot AI review requested due to automatic review settings April 8, 2026 19:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the development MinIO endpoint hostname so that Active Storage redirects remain same-site with the app, avoiding CORS failures during service worker fetch(..., { mode: "cors" }) requests.

Changes:

  • Update the devminio S3 endpoint from minio.localhost to minio.fizzy.localhost in both OSS and SaaS storage configs.
  • Update development CSP overrides (connect_src, img_src) to allow the new MinIO origin.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
saas/config/storage.yml Points SaaS dev MinIO endpoint at minio.fizzy.localhost:39000 to keep redirects same-site.
config/storage.oss.yml Points OSS dev MinIO endpoint at minio.fizzy.localhost:39000 to keep redirects same-site.
config/environments/development.rb Updates CSP allowances to match the new MinIO origin in dev.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.
@flavorjones flavorjones merged commit 45d1657 into main Apr 8, 2026
9 of 13 checks passed
@flavorjones flavorjones deleted the fix-dev-minio branch April 8, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants