APIGatawayで、指定のヘッダーが無いとリクエストを拒否する設定
APIGatawayのリソースポリシーに以下を設定
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:ap-northeast-1:{アカウントID}:{APIリソースの識別英数字}/*",
"Condition": {
"StringNotEquals": {
"aws:Referer": "{適当な文字列}"
}
}
},
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:ap-northeast-1{アカウントID}:{APIリソースの識別英数字}/*"
}
]
}