diff --git a/src/minio.js b/src/minio.js index 2c44b114..f6315c00 100644 --- a/src/minio.js +++ b/src/minio.js @@ -1194,10 +1194,14 @@ export class Client extends TypedClient { // * `expiry` _number_: expiry in seconds (optional, default 7 days) // * `reqParams` _object_: request parameters (optional) e.g {versionId:"10fa9946-3f64-4137-a58f-888065c0732e"} // * `requestDate` _Date_: A date object, the url will be issued at (optional) - presignedUrl(method, bucketName, objectName, expires, reqParams, requestDate, cb) { + // * `signedHost` _string_: The hostname that will be allowed to access the resource (optional) + presignedUrl(method, bucketName, objectName, expires, reqParams, requestDate, signedHost, cb) { if (this.anonymous) { throw new errors.AnonymousRequestError('Presigned ' + method + ' url cannot be generated for anonymous requests') } + if (isFunction(signedHost)) { + cb = signedHost + } if (isFunction(requestDate)) { cb = requestDate requestDate = new Date() @@ -1233,7 +1237,11 @@ export class Client extends TypedClient { // This statement is added to ensure that we send error through // callback on presign failure. var url - var reqOptions = this.getRequestOptions({ method, region, bucketName, objectName, query }) + var headers = {} + if(signedHost) { + headers.host = signedHost + } + var reqOptions = this.getRequestOptions({ method, region, bucketName, objectName, query, headers }) this.checkAndRefreshCreds() try {