2017-08-24 6 views
0

サーバーレスのCloudFrontでHTTP/2サポートを有効にする方法は?サーバーレスのCloudFrontでHTTP/2サポートを有効にする方法は?

私はサーバーレス(https://github.com/serverless/serverless)を使用して、CloudFrontを使用しているS3コンテナからHTML + JSを提供する簡単なサーバーレスアプリケーションを作成しています。

この目的のために、私は後でserverless.ymlテンプレートを作成します。このテンプレートは、後でこのセットアップを構築します。

CloudFrontでHTTP/2サポートを有効にするには、テンプレートに何を含めるか/設定する必要がありますか?

答えて

0

これはHttpVersion加えることによって達成することができます: 'HTTP2'以下DistributionConfig:プロパティを。以下の完全な例を参照してください。

## Specifying the CloudFront Distribution to server your Web Application 
WebAppCloudFrontDistribution: 
    Type:        AWS::CloudFront::Distribution 
    Properties: 
    DistributionConfig: 
     HttpVersion:     'http2' 
     Origins: 
     - DomainName:     ${self:custom.s3Bucket}.s3.amazonaws.com 
      ## An identifier for the origin which must be unique within the distribution 
      Id:       WebApp 
      CustomOriginConfig: 
      HTTPPort:     80 
      HTTPSPort:    443 
      OriginProtocolPolicy:  https-only 
      ## In case you want to restrict the bucket access use S3OriginConfig and remove CustomOriginConfig 
      # S3OriginConfig: 
      # OriginAccessIdentity: origin-access-identity/cloudfront/E127EXAMPLE51Z 
     Enabled:      'true' 
     ## Uncomment the following section in case you are using a custom domain 
     # Aliases: 
     # - mysite.example.com 
     DefaultRootObject:    index.html 
     ## Since the Single Page App is taking care of the routing we need to make sure ever path is served with index.html 
     ## The only exception are files that actually exist e.h. app.js, reset.css 
関連する問題