fix(storage): honor MINIO_PUBLIC_URL for browser-facing object URLs#1102
Conversation
Screenshot/file URLs written to a run's binaryOutput were built from the internal MinIO host/port (defaulting to localhost:9000). Any deployment where MinIO sits behind a reverse proxy or on a non-localhost public address produced unreachable URLs, so stored screenshots never loaded. Prefer a complete public base URL via MINIO_PUBLIC_URL (e.g. https://storage.example.com) and fall back to the existing MINIO_PUBLIC_HOST:MINIO_PORT composition for local/dev setups, so existing configurations are byte-for-byte unchanged. Documents the variable in ENVEXAMPLE. Fixes getmaxun#832
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR enables configurable MinIO public URLs in self-hosted deployments behind reverse proxies. The ChangesMinIO Public URL Configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for a configurable browser-facing MinIO base URL to avoid generating unreachable localhost:9000 links in proxied/non-default deployments.
Changes:
- Build public object URLs from
MINIO_PUBLIC_URLwhen set, with fallback toMINIO_PUBLIC_HOST+MINIO_PORT. - Trim trailing slashes from the configured public base before concatenating path segments.
- Document the new
MINIO_PUBLIC_URLvariable inENVEXAMPLE.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| server/src/storage/mino.ts | Prefer a fully specified public base URL for generated object links, with normalization and fallback behavior. |
| ENVEXAMPLE | Documents MINIO_PUBLIC_URL for reverse-proxy/public-endpoint setups. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const publicBase = ( | ||
| process.env.MINIO_PUBLIC_URL | ||
| ? process.env.MINIO_PUBLIC_URL | ||
| : `${process.env.MINIO_PUBLIC_HOST || 'http://localhost'}:${process.env.MINIO_PORT || '9000'}` | ||
| ).replace(/\/+$/, ''); | ||
| const publicUrl = `${publicBase}/${this.bucketName}/${minioKey}`; |
| # Public base URL browsers use to reach stored screenshots/files. Set this when | ||
| # MinIO is behind a reverse proxy or on a non-localhost/non-9000 public address, | ||
| # e.g. https://storage.example.com (no internal port appended). Optional. | ||
| # MINIO_PUBLIC_URL=https://storage.example.com |
amhsirak
left a comment
There was a problem hiding this comment.
@Osamaali313 lgtm - thanks! 🙌
Description
Stored screenshots/files never load on any deployment where MinIO is not reachable at
localhost:9000from the browser (reverse proxy, separate host, or a non-default public port).Root cause
In
server/src/storage/mino.ts, the browser-facing object URL written to a run'sbinaryOutputwas composed from the internal MinIO host/port:MINIO_PORTis the internal MinIO port used for theminioclient connection, and the host defaults tolocalhost. So in a typical Docker/proxied deploy the generated URLs point atlocalhost:9000(or force:9000onto a proxied host likehttps://storage.example.com:9000/...), which the browser cannot reach — the screenshots silently 404. This matches the report in #832.Fix
Prefer a complete public base URL via a new optional
MINIO_PUBLIC_URL, and only fall back to the existingMINIO_PUBLIC_HOST:MINIO_PORTcomposition when it is not set:MINIO_PUBLIC_HOST+MINIO_PORTcases).MINIO_PUBLIC_URL=https://storage.example.comand get correct, reachable URLs (no internal port appended).ENVEXAMPLE.Fixes #832
Testing
No automated test suite exists in the repo, so I verified the URL-building logic in isolation across cases:
http://localhost:9000/<bucket>/<key>(unchanged)MINIO_PUBLIC_HOST=http://1.2.3.4,MINIO_PORT=9000http://1.2.3.4:9000/<bucket>/<key>(unchanged)MINIO_PUBLIC_URL=https://storage.example.comhttps://storage.example.com/<bucket>/<key>(fixed)MINIO_PUBLIC_URL=https://storage.example.com/Summary by CodeRabbit
New Features
Documentation