Skip to content

Server: no hook to rewrite the presign response (proxied / non-browser-reachable storage endpoints) #338

Description

@BSalaeddin

Our storage endpoint isn't reachable from the browser: prod does same-origin PUTs through an /api/s3-proxy route, and local dev signs against a docker-internal MinIO hostname. With the old hand-rolled route we just rewrote the presigned URL before returning it to the client.

createUpupHandler / createUpupNextHandler have no hook on the response side — hooks is only onBeforeUpload / onFileUploaded / onUploadComplete — so there's no way to rewrite uploadUrl / publicUrl before they leave the server. That makes the shipped handlers unusable for any deployment where the bucket isn't directly browser-reachable (private MinIO behind a proxy, VPC-only endpoints, etc.).

Related smaller thing: onBeforeUpload returning false becomes a generic rejection, so a pre-presign quota check ("storage limit exceeded, upgrade to keep uploading") loses its message on the way to the client. Letting the hook throw an UpupError that gets serialized into the error response would cover that.

Suggestion: an onPresignResponse(response, ctx)-style hook that can return a modified PresignedUrlResponse. That one hook would have let us adopt the built-in handler instead of keeping a custom route.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions