You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When accessed through CloudFront, the @id field of the info.json file is using the standalone function URL as the base instead of the CloudFront domain URL.
Done Looks Like
@id is correct when accessed via standalone or CloudFront
The text was updated successfully, but these errors were encountered:
mbklein
changed the title
Use x-forwarded-for header in the info.json's @id if present
Use x-forwarded-host header in the info.json's @id if present
Jul 15, 2022
This issue cannot be fixed automatically. serverless-iiif already supports overriding the domain name two different ways:
Setting the Lambda function's forceHost environment variable to the desired hostname
Passing an x-forwarded-host header from CloudFront
Both of these methods are already working correctly in the code. The problem is that:
CloudFront does not automatically include its own domain name in the x-forwarded-host header
SAM/CloudFormation can't resolve the CloudFront domain name at deploy time to set it as a custom origin header or to set the Lambda function's forceHost variable
The only ways to get this working at the moment would be:
After deploying, manually update either the forceHost environment variable on the lambda or add an x-forwarded-host header to the lambda origin on the CloudFront distribution, with the value being the domain name of the CloudFront distribution
Add a Viewer-Request function to copy the contents of the incoming Host header to x-forwarded-host
Use a custom domain name (which already sets forceHost)
None of these is a perfect solution to the problem, especially since every redeploy/update will wipe out the manual configuration. It might be possible to store the lambda function's configuration somewhere else (like in Parameter Store or Secrets Manager), which would make this easy. But then we'd incur the overhead of fetching the configuration on every invocation.
Description
When accessed through CloudFront, the
@id
field of theinfo.json
file is using the standalone function URL as the base instead of the CloudFront domain URL.Done Looks Like
@id
is correct when accessed via standalone or CloudFrontThe text was updated successfully, but these errors were encountered: