【问题标题】:Is it possible to define a custom error when accessing blobs from the Azure Blob Service using Shared Access Signatures?使用共享访问签名从 Azure Blob 服务访问 Blob 时是否可以定义自定义错误?
【发布时间】:2020-01-14 20:44:24
【问题描述】:

我有一个显示从 blob 存储中检索到的图像的客户端应用程序。 Blob 受 SAS 签名保护。当对 blob 的访问过期时,blob 服务会返回如下错误消息。

<Error>
    <Code>AuthenticationFailed</Code>
    <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:399b5e5d-d01e-0022-0813-cb9080000000 Time:2020-01-14T19:45:06.9253703Z
    </Message>
    <AuthenticationErrorDetail>Signed expiry time [Fri, 22 Nov 2019 11:27:07 GMT] must be after signed start time [Tue, 14 Jan 2020 19:45:06 GMT]
    </AuthenticationErrorDetail>
</Error>

是否可以自定义 blob 服务返回的此错误消息?

【问题讨论】:

    标签: azure azure-blob-storage


    【解决方案1】:

    除非您使用 API 来提供 blob,否则您将无法拦截/更改来自 Azure 存储服务的响应。

    【讨论】:

    • 认为可能是这样。 :( 如果没有人提出更好的建议,我会将其标记为答案。
    • @Nattrass - 没有比这更好的了:错误消息来自 Azure 本身。您的 SAS 令牌要么有效,要么无效。控制任何类型响应的唯一方法是使用您自己的 API,如答案中所述。
    猜你喜欢
    • 1970-01-01
    • 2013-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-21
    • 1970-01-01
    • 2021-08-13
    • 2013-06-28
    相关资源
    最近更新 更多