1

I have tried this

{
   "DomainName": "myapi.execute-api.us-east-1.amazonaws.com/dev,
   "Id": "APIEndPoint",
   "CustomOriginConfig": {
   "OriginProtocolPolicy": "https-only",
   "OriginSSLProtocols":["TLSv1", "TLSv1.1", "TLSv1.2"]
}

Ref: https://aws.amazon.com/about-aws/whats-new/2014/12/16/amazon-cloudfront-now-allows-directory-path-as-origin-name/.

But I am getting the below error

The parameter origin name must be a domain name.
(Service: AmazonCloudFront; 
Status Code: 400; 
Error Code: InvalidArgument; Request ID:
vamsi chunduru
  • 349
  • 5
  • 14

1 Answers1

5

I have found the answer we just need to add OriginPath attribute. Here it is

{
  "DomainName": {
    "Ref": "APIGatewayEndpoint"
  },
  "Id": "APIEndPoint",
  "CustomOriginConfig": {
    "OriginProtocolPolicy": "https-only",
    "OriginSSLProtocols": [
      "TLSv1",
      "TLSv1.1",
      "TLSv1.2"
    ]
  },
  "OriginPath": {
    "Fn::Join": [
      "",
      [
        "/",
        {
          "Ref": "APIStage"
        }
      ]
    ]
  }
}
vamsi chunduru
  • 349
  • 5
  • 14