Serverless Image Handler
Serverless Image Handler

Appendix F: Rewrite Feature

This feature allows customers to migrate their current image request model to the Serverless Image Handler solution, without changing their applications to accommodate new image URLs. This feature requires you to populate the following environment variables in the image handler function. These environment variables are added to the function by default but are left empty for user input if the rewrite feature is needed.

Parameter Default Description
RewriteMatchPattern Regex By default, this parameter is empty. Contains a JavaScript-compatible regular expression for matching custom image requests using the rewrite function.
RewriteReplacePattern String By default, this parameter is empty. Contains a substitution string for custom image requests using the rewrite function.

The rewrite feature translates custom URL image requests into Thumbor-consumable formats, based on JavaScript-compatible regular expression match patterns and substitution strings. Once the image request is converted into Thumbor-consumable form, it is then processed as a Thumbor image request and edits are mapped to the new Sharp image library.