簡體   English   中英

Azure Blob - 403 上傳 - Sitecore CM/CD 拓撲

[英]Azure Blob - 403 on upload - Sitecore CM / CD topology

我正在嘗試使用 Azure.Storage.Blob 庫將來自 Sitecore 網站的圖像上傳到 Azure Blob 存儲中。 在單個拓撲中,在我們的測試環境中,它可以毫無問題地工作,即使在我們的本地設置上也是如此。 另一方面,在我們的暫存環境(具有 CM/CD 拓撲)中,它會拋出 403 狀態。

存儲帳戶是公共的,我們可以從本地機器/測試環境對該存儲帳戶進行任何操作。 此外,對於暫存環境,我們確實在 Azure 中設置了一個前門,但即使禁用它,仍然拋出相同的異常。

有沒有人遇到過這個問題? 調查了幾天,但我變得一無所知。 謝謝你。

例外情況如下:


Exception: Azure.RequestFailedException
Message: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:8e1769d5-e01e-001e-0499-ac8ce4000000
Time:2022-08-10T09:13:32.0353745Z
Status: 403 (Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.)
ErrorCode: AuthenticationFailed

Additional Information:
AuthenticationErrorDetail: The MAC signature found in the HTTP request 'cJB+JGEEjhxJiYsAlcnlZOBw09rreVlAd5eJMis7vD0=' is not the same as any computed signature. Server used following string to sign: 'PUT

887486

application/octet-stream

x-ms-blob-type:BlockBlob
x-ms-client-request-id:5a970fad-c322-41dd-9c79-be7b52057fdd
x-ms-date:Wed, 10 Aug 2022 09:13:32 GMT
x-ms-request-id:|NoBMxLCuSY4=.5431b150_8.
x-ms-request-root-id:NoBMxLCuSY4=
x-ms-return-client-request-id:true
x-ms-version:2021-04-10
/[sa_name]/[container_name]/AdvertisementMedia/10c8df42-8803-4acb-38eb-08da7a1ea032/5viawtti.zki.png'```

當 MAC 簽名格式不正確或使用不正確的密鑰簽名時,通常會發生此錯誤。 如果您直接使用 Azure.Storage.Blob 庫,Sitecore 應用程序的 CM/CD 拓撲無關緊要。

但是,如果相同的代碼和配置在其他環境中運行正常,請嘗試比較 HTTP 標頭以識別本地環境和暫存環境之間的差異。 以下是我過去看到的幾個常見原因:

  1. x-ms-date header 包含不正確的日期或日期不正確的時區。 日期應為當前 UTC 日期時間且不超過 15 分鍾,否則 Azure 存儲服務將返回響應代碼403 (Forbidden) 如果您的登台服務器使用與 UTC 不同的時區,則可能是問題所在。
  2. MAC 簽名中不包含一個額外的 header。 例如,我可以在您的異常中看到 header x-ms-request-root-id ,Application Insights 會自動將其添加到傳出請求中。 如果在暫存環境中具有啟用依賴項跟蹤的 Application Insights,請確保在ApplicationInsights.config中為域core.windows.net禁用其他 HTTP 標頭:
<TelemetryModules>
   <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"> 
      <ExcludeComponentCorrelationHttpHeadersOnDomains>
         <Add>core.windows.net</Add> 
      </ExcludeComponentCorrelationHttpHeadersOnDomains>
   </Add>
</TelemetryModules>

您可以在此處閱讀有關簽名字符串的更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM