Debugging Cloudfront with multiple origins (S3 + API Gateway) : path pattern not working.

1

I have set up a cloudfront instance with 2 origins (frontend and backend) for a relatively simple SPA app with a KOA backend. When either origin is set as the default (*) behavior, it works exactly as expected. Whenever I add a second origin (i.e. path pattern /v1/* ), it fails to recognize the pattern and instead tries to load the resource from the default (*) origin. I can flip back and forth by just changing which the default is pointing at, and that origin works fine, but the second path is never accessed.

The precedence is
0: /v1/* , APIGateway (origin path = "/Prod"

1: default(*) , S3

calling xxx.cloudfront.net/v1/test gives me a blank page from the react frontend (i.e. I see all the metadata, and the same as xxx.cloudfront.net/nonsense).

calling xxx.cloudfront.net/ launches the frontend, as expected.

calling xxx.execute-api.us-west-2.amazonaws.com/Prod/test gives me "Hello World"

Currently in the process of putting a bullet in it and running two cloudfronts (and all the CORS headaches that entails)

demandé il y a 2 ans1283 vues
1 réponse
0

I recommend you get in touch with AWS Support for help with this.

The only other suggestions I have for you are to ensure you have read the documentation: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html and/or to try out this CloudFront workshop: https://catalog.us-east-1.prod.workshops.aws/v2/workshops/9331108e-464e-4699-8a9c-486090105878/en-US/ to see if you can identify what might be wrong with your own distribution.

AWS
EXPERT
Paul_L
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions