从Lambda@Edge Viewer Request中删除默认标头。

0

【以下的问题经过翻译处理】 我创建了一个lambda@edge韩式,用于在Viever Request时进行身份验证。如果请求被拒绝,我希望向调用者提供尽可能少的信息,因此希望删除一些标头(不让调用者知道我正在使用AWS)。

我找到了一种通过返回该标头的新值来覆盖标头的方法,示例中的服务器可见。 但是,我如何删除x-amz-cf-id或x-cache标头?

import json

def lambda_handler(event, context):

    response = event["Records"][0]["cf"]["request"]
    headers = response["headers"]

    #check authentication... omitted
    #....

    response = {
        'status': status,
        'statusDescription': status_desc,
        'headers': {
                    'server': [
                        {
                            'key': 'server',
                            'value': 'x'
                        }
                    ]
                }
    }

    return response

profile picture
专家
已提问 5 个月前21 查看次数
1 回答
0

【以下的回答经过翻译处理】 您不能删除默认标头。即使您可以,CloudFront的IP地址仍将显示您正在使用AWS。

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则