0
0

More than 3 years have passed since last update.

S3をWebサーバーにしてコンテンツを公開する⑤(CloudFront署名付きCookie編)

Last updated at Posted at 2021-03-11

S3をWebサーバーにして静的コンテンツを公開する方法を紹介します。

  1. S3パブリック編
  2. S3署名付きURL編
  3. CloudFrontパブリック編
  4. CloudFront署名付きURL編
  5. CloudFront署名付きCookie編 ←コレ!

手順

今回の手順は、CloudFront署名付きURL編の続きで実施します。

Cookieの設定

aws cloudfront signコマンドで生成した署名付きURLのパラメーターをCookieに設定します。

Cookie Name Cookie Value
CloudFront-Expires 署名付きURLのExpires
CloudFront-Key-Pair-Id 署名付きURLのKey-Pair-Id
CloudFront-Signature 署名付きURLのSignature

ただ署名付きURLのパラメーターの接頭辞としてCloudFront-がついてるだけですね。
このCookieが設定されていれば、署名付きURLのクエリパラメーターがなくても、プライベートコンテンツにアクセスできるということです。

■署名付きURLの場合
https://d168j73yp42rht.cloudfront.net/private/index.html?Expires=XXXXXXXXXX&Key-Pair-Id=XXXXXXXXXX&Signature=XXXXXXXXXX

署名付きCookieの場合
https://d168j73yp42rht.cloudfront.net/private/index.html
※CookieでCloudFront-Expires、CloudFront-Key-Pair-Id、CloudFront-Signatureの指定が必要

以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0