samvera / serverless-iiif

IIIF Image API 2.1 & 3.0 server in an AWS Serverless Application
https://samvera.github.io/serverless-iiif/
Apache License 2.0
71 stars 23 forks source link

Use `x-forwarded-host` header in the info.json's @id if present #77

Closed mbklein closed 2 years ago

mbklein commented 2 years ago

Description

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

mbklein commented 2 years ago

This issue cannot be fixed automatically. serverless-iiif already supports overriding the domain name two different ways:

Both of these methods are already working correctly in the code. The problem is that:

The only ways to get this working at the moment would be:

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.