Copying Azure blobs withing an azure container is failing using Azure API

Hi there,

Has any of you faced this issue? It’s quite baffling.
We are in the process of migrating to Lucee and found out that Azure copy is not working with Lucee. It’s the exact same code, which works well in Adobe Coldfusion but fails saying that the authentication failed and the signature is not formed correctly.
My question here is are there any differences between adobe coldfusion and Lucee in the encoding/decoding methods?

a code sample really helps

local.requestMethod = "PUT";
	local.xmsDate = xmsDate(Now());
	local.canonicalizedResource = "/<accountname>/<containername>/D/<foldername>/<filename>";
	local.canonicalizedSource = "https://<accountname>.blob.core.windows.net/<containername>/E/<foldername>/<sourcefilename>";
	local.canonicalizedHeaders = "x-ms-copy-source:#local.canonicalizedSource#\nx-ms-date:#local.xmsDate#\nx-ms-version:2019-10-10";
	local.requestSignature = getSignature(verb=local.requestMethod, canonicalizedHeaders=local.canonicalizedHeaders, canonicalizedResource=local.canonicalizedResource);
	//This is the string to sign. I can dump these values and get that working in Postman. So I assume this works okay
	local.endPoint = "https://<accountname>.blob.core.windows.net/<containername>/<foldername>/<filename>";
	cfhttp( url="#local.endPoint#", result="local.result", method="#local.requestMethod#", throwonerror="true" ) {
		cfhttpparam( name="Authorization",type="header",value="SharedKey #getAccount()#:#local.requestSignature#");  
		cfhttpparam( name="x-ms-copy-source", type="header", value=local.canonicalizedSource );
		cfhttpparam( name="x-ms-date", type="header", value=local.xmsDate );
		cfhttpparam( name="x-ms-version", type="header", value=getXmsVersion() );
		cfhttpparam( name="Content-length",type="header", value="0" );
	}
	//Is there anyway to dump the raw http request?

use a local proxy to see the raw http request

Thank you. Let me try that.

There are few differences between the cfhttp request made by ACF and Lucee.

Lucee:
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Connection: Keep-Alive
Accept-Encoding: gzip

ACF:
Connection: close
Accept-Encoding: gzip,deflate

ACF doesn’t have the content-type param and it’s not explicitly set in the cfhttp request. These differences are causing the issues. Is it possible to remove content-type param which is being added automatically?

Setting the Content-Type empty solved the issue

cool!

@markdrew has a ticket to include the sent headers in the result object for CFHTTP [LDEV-2153] - Lucee

That’s good to know. Thanks.