"X-Cache: Miss from cloudfront" as a result of a call to AWS API Gateway

In a nutshell as a result of deploying a serverless.yml file, AWS creates API Gateway for S3 bucket and hidden CloudFront distribution (you can’t have direct access to it via AWS console), and when an HTTP request goes through this pipeline a 200 response to it is provided with the X-Cache: Miss from cloudfront header. The same header with the same value repeatedly occurs despite using the custom domain name or the API Gateway Invoke URL. (test were done in browser and POSTMAN):

Do you have any idea how I can rewrite the serverless.yml file for receiving a 200 response with the X-cache:HIT header, or at least what I have to improve via AWS Console?

This is the configuration that I deploy:

# serverless.yml

service: s3-blablabla-service

provider:
  name: aws
  stage: dev
  region: us-east-1
  environment:
    SERVICE_NAME: ${self:service}
  apiGateway:
    binaryMediaTypes: "*/*"

plugins:
  - serverless-apigateway-service-proxy
  - serverless-domain-manager
  - serverless-finch

custom:
  c3launchBucketName: "blabla-pl-${self:provider.stage}"
  c3scormBucketName: "blabla-crs-${self:provider.stage}"
  domainName: "${self:provider.stage}blablabla.bla.com" # Change this to your domain.
  basePath: "" # This will be prefixed to all routes
  apiGatewayServiceProxies:
    - s3:
        path: /pl/{myKey+} # use path param
        method: get
        action: GetObject
        bucket:
          # ${self:custom.c3launchBucketName}
          Ref: S3Bucket
        key:
          pathParam: myKey
        requestParameters:
          "integration.request.header.cache-control": "'public, max-age=31536000, immutable'"
    - s3:
        path: /crs/{myKey+} # use path param
        method: get
        action: GetObject
        bucket:
          # ${self:custom.c3scormBucketName}
          Ref: S3ScormBucket
        key:
          pathParam: myKey
        requestParameters:
          "integration.request.header.cache-control": "'public, max-age=31536000, immutable'"
  customDomain:
    domainName: ${self:custom.domainName}
    basePath: ${self:custom.basePath}
    stage: ${self:provider.stage}
    createRoute53Record: true
    autoDomain: true
  client:
    bucketName: ${self:custom.c3launchBucketName}
resources:
  Resources:
    S3Bucket:
      Type: 'AWS::S3::Bucket'
      Properties:
        BucketName:  ${self:custom.c3launchBucketName}
    S3ScormBucket:
      Type: 'AWS::S3::Bucket'
      Properties:
        BucketName:  ${self:custom.c3scormBucketName}

After the deployment I receive this result:

endpoints:
  GET - https://blablabla.execute-api.us-east-1.amazonaws.com/dev/pl/{myKey+}
  GET - https://blablabla.execute-api.us-east-1.amazonaws.com/dev/crs/{myKey+}

Service deployed to stack s3-blablabla-service-dev

Serverless Domain Manager:
  Domain Name: devblablabla.bla.com
  Target Domain: abrakadabra.cloudfront.net
  Hosted Zone Id: BARBARBAR

Hello @ImishinM , did you find a solution? I’m facing exactly the same issue.