diff --git a/lib/api/objectPost.js b/lib/api/objectPost.js index 99086e03a0..399da5e5db 100644 --- a/lib/api/objectPost.js +++ b/lib/api/objectPost.js @@ -95,9 +95,9 @@ function objectPost(authInfo, request, streamingV4Params, log, callback) { }); if (storingResult) { // ETag's hex should always be enclosed in quotes - responseHeaders.location = `/${bucketName}/${encodeURIComponent(request.formData.key)}`; - responseHeaders.Bucket = bucketName; responseHeaders.ETag = `"${storingResult.contentMD5}"`; + responseHeaders.location = + `${request.headers.host}/${bucketName}/${encodeURIComponent(request.formData.key)}`; } const vcfg = bucket.getVersioningConfiguration(); const isVersionedObj = vcfg && vcfg.Status === 'Enabled'; diff --git a/tests/functional/aws-node-sdk/test/object/post.js b/tests/functional/aws-node-sdk/test/object/post.js index 7997af7d74..4f3f1908ba 100644 --- a/tests/functional/aws-node-sdk/test/object/post.js +++ b/tests/functional/aws-node-sdk/test/object/post.js @@ -185,7 +185,7 @@ describe('POST object', () => { req.on('response', res => { try { assert.equal(res.statusCode, 204); - assert.equal(res.headers.location, `/${bucketName}/${filename}`); + assert.equal(res.headers.location, `${url.hostname}:${url.port}/${bucketName}/${filename}`); done(); } catch (err) { done(err); @@ -234,7 +234,7 @@ describe('POST object', () => { req.on('response', res => { try { assert.equal(res.statusCode, 204); - assert.equal(res.headers.location, `/${bucketName}/${encodedKey}`); + assert.equal(res.headers.location, `${url.hostname}:${url.port}/${bucketName}/${encodedKey}`); done(); } catch (err) { done(err);