Skip to content

Mappings Fail in ECS #639

Description

@eyespies

Describe the bug
I've deployed the ECS stack. I've configured an origin (HTTPS, cloudfront in front of replicated S3 buckets, so https://cdn.example.com). I've configured a transformation called "Mobile". I've added a mapping that uses the HTTPS origin and the transformation. I assigned the prefix "/mobile/*".

Based on the documentation which says:

https://<cloudfront-domain>/<mapping-pattern>/<image-path>

with the example

https://d1234567890.cloudfront.net/mobile/sample-image.jpg

I would expect that the flow would be:

https://dit.example.com/mobile/my-photo.jpg -> routes to DIT -> determines mapping / transform / origin -> requests https://cdn.example.com/my-photo.jpg -> transforms according to Mobile transformation -> returns transformed image

But that does not happen. Instead I get an error about INVALID_FORMAT and the log message "Origin does not serve image content. Content-Type: text/html" (it would be GREAT to know what the origin URL is here!)

My only guess, based on using curl, is that the DIT is using the unmodified path /mobile/my-photo.jpg when requesting from the origin, so I expected the origin request to be https://cdn.example.com/my-photo.jpg, but DIT is actually requesting https://cdn.example.com/mobile/my-photo.jpg.

There is an extreme lack of documentation on how to use DIT with ECS; there is a LOT of documentation for Lambda. I tried using generic patterns, e.g. the base64 encoded URLs, but those didn't work and there is no documentation for using them with mappings (are mappings even needed?)

To Reproduce

  1. Deploy to ECS
  2. Create a mapping with a path prefix where the prefix is NOT part of your origin URL path
  3. Request the image from the DIT endpoint using the prefix + the full path to the image in the origin
  4. boom error message

Expected behavior
The ability to setup mappings that strip the prefix and perform a transform. For example:

  • /mobile/* -> transforms photos according to the MobileImages transform
  • /profile/* -> transforms photos according to the UserProfile transform
  • /large/* -> transforms photos according to the Large transform

also more documentation on how to use mappings (or not use mappings) with the other parameters..

Please complete the following information about the solution:

  • [8.0.3] Version: [e.g. v1.0.0]
  • [us-east-2] Region: [e.g. us-east-1]
  • [no] Was the solution modified from the version published on this repository?
  • [n/a] If the answer to the previous question was yes, are the changes available on GitHub?
  • [no; but I doubt that is the issue] Have you checked your service quotas for the sevices this solution uses?
  • [yes] Were there any errors in the CloudWatch Logs?

Screenshots

Additional context

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions