Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/utils/minio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ export async function storeBufferToMinIO(
const protocol = useSSL ? "https" : "http";
const endPoint = process.env.MINIO_ENDPOINT || "localhost";
const port = process.env.MINIO_PORT || "9000";
const url = `${protocol}://${endPoint}:${port}/${BUCKET_NAME}/${objectName}`;

// Don't include standard ports in URL to support Nginx reverse proxy
const isStandardPort =
(protocol === "https" && port === "443") ||
(protocol === "http" && port === "80");
const url = isStandardPort
? `${protocol}://${endPoint}/${BUCKET_NAME}/${objectName}`
: `${protocol}://${endPoint}:${port}/${BUCKET_NAME}/${objectName}`;

return url;
} catch (error) {
Expand Down