从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
ESPERTO
posta 5 mesi fa24 visualizzazioni
1 Risposta
0

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

profile picture
ESPERTO
con risposta 5 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande