Skip to content

URL rewrite not working for us - adding unsafe to the url? #54

@adam91holt

Description

@adam91holt

Hi,

We are using the serverless image resizer in a new project and also looking to bring it into an old project. However, we want to use a similar URL to how we used to do image resizing on the server which was like.

/AUS/image001.jpg?h=400&w=400

In the image resizer for the serverless URL this needs to be...

/fit-in/400x400/AUS/image001.jpg

We have come up with the following Regexp for Python as per the docs https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/appendix-b.html

[(r'^([\w\./]+)\?h=([\d]+)&w=([\d]+)$', r'/fit-in/\2x\3\1'),(r'^([\w\./]+)\?w=([\d]+)&h=([\d]+)$', r'/fit-in/\3x\2\1')]

However, this is never resizing the image and in the cloudwatch logs we are getting logs like the following.

[INFO] 2018-09-20T08:40:47.149Z dd22ee1e-bcb0-11e8-8346-6fbe28a7c414 200 GET /unsafe/AUS/image001.jpg (0.0.0.0) 961.66ms

The URL in the log obviously doesn't have the '/fit-in/400x400' and '/unsafe' is added to the URL.

If anyone could help here that would be fantastic. The lambda function was deployed using the cloud formation template and has not been modified. We have specified in the environment variables for the lambda function that rewrite is enabled and the rewrite pattern above.

Thanks

screenshot_092618_102926_am

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions