amplify-android icon indicating copy to clipboard operation
amplify-android copied to clipboard

API Gateway endpoint to Cloudfront endpoint

Open RicardoJC opened this issue 4 years ago • 2 comments

Hello everyone!

Do you know if there is a way to change an API endpoint in amplifyconfiguration.json to be a CloudFront endpoint?

I have a WAF connected to CloudFront endpoint. This link is associated with an API Gateway URL.

For example:

"apiProject": {
    "endpointType": "REST",
    "endpoint": "https://xxxxxxxxx.cloudfront.net",
    "region": "...",
    "authorizationType": "AWS_IAM"
}

The error is:

The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. \n\nThe Canonical String for this request should have been ... host: xxxxxxxxxx.execute-api.xx-xxxxx-x.amazonaws.com

Is there a way to use a CloudFront URL in the endpoint field? Thanks.

RicardoJC avatar Aug 26 '20 21:08 RicardoJC

@RicardoJC We do not currently support this, no. I've marked #760 as a feature request.

There are a few challenges to confront, to support it.

Firstly, and to the point of your error message, we'd need to update the Sig4 signing. The current implementation hard-codes the service names of the endpoint, as either "appsync" or "apigateway". This assumption would be invalid if the client is communicating with CloudFront, instead.

jamesonwilliams avatar Sep 16 '20 00:09 jamesonwilliams

Another customer requested this feature in https://github.com/aws-amplify/amplify-android/issues/1328, but for Akamai, rather than Cloudfront.

richardmcclellan avatar Jun 23 '21 02:06 richardmcclellan