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)

gefragt vor 2 Jahren1283 Aufrufe
1 Antwort
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
EXPERTE
Paul_L
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen