CloudFront+S3+쿠키 인증
3367 단어 CloudFrontS3
S3
특히 없음 평소대로
public 액세스 등은 없음
Cloud Front
CNAME 등의 설정 생략
Origin 설정

Restrict Bucket Access를 Yes로 설정 Origin Access Identity에서 Create a New Identity로 설정하면 오리진 액세스 신원이 새로 생성됩니다 Grant Read Permissions on Bucket를 Yes, Update Bucket Policy로 설정하면 S3 버킷의 버킷 정책이 자동으로 업데이트됩니다 Behavior 설정

Restrict Viewer Access를 Yes로 설정 Trusted Signers에서 Self 확인 맞춤 정책
{
"Statement": [
{
"Resource": "https://hogehoge.com/*",
"Condition": {
"DateLessThan": {
"AWS:EpochTime": 1561417200
}
}
}
]
}
인증에 필요한 쿠키
CloudFront-Policy
cat policy.json | openssl base64 | tr '+=/' '-_~'CloudFront-Signature
cat policy.json | openssl sha1 -sign pk.pem | openssl base64 | tr '+=/' '-_~'CloudFront-Expires
Epoch Time Format
CloudFront-Key-Pair-Id
Cloud Front 인증 키 ID (루트 계정에서만 만들 수 있음)
CORS 설정
Behaviors에서,Cache Based on Selected Request Headers ~ WhitelistWhitelist Headers 에 Origin Access-Control-Request-Headers Access-Control-Request-Method 추가
S3 액세스 권한으로
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>https://hogehoge.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
어쨌든 느낌으로 저장
Test
curl -H 'Cookie: CloudFront-Expires=1741360031; CloudFront-Policy=; CloudFront-Signature=; CloudFront-Key-Pair-Id=XXXXXX' https://hogehoge.com/hoge/sample.html
Reference
이 문제에 관하여(CloudFront+S3+쿠키 인증), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/rmdroid/items/3f933d09193f06653c79텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)