I have a lambda setup with the proxy integration in API Gateway.
I can call my lambda with a URL like https://7kbw9fcfa4.execute-api.us-east-1.amazonaws.com/dev/foo The path here is /dev/foo.
However if I set up CloudFront in front of that, the URL becomes https://a45ex7tnds5r5o.cloudfront.net/foo and the path is /foo.
In both cases I have the same keys in the event variable:
pathcontains/foorequestContext.pathcontains/dev/foo
How can I get reliably the actual URL that the client sees in the browser? (both when using Cloudfront and when using API Gateway directly)
Hostheader because it is recommended not to forward it (else it messes up the Cloudfront -> API Gateway connection). TheOriginheader doesn't seem to be useful as it contains only the domain name, not the path (see developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin). - Matthieu Napoli