question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
gsingh04commented, Oct 3, 2018

@razor-x thanks for raising the concern, please allow us sometime to address it.

0reactions
gsingh04commented, Nov 8, 2018

resolving this as #67 is a separate issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

URL rewrite not working for us - adding unsafe to the url? #54
Hi, We are using the serverless image resizer in a new project and also looking to bring it into an old project.
Read more >
IIS Url Rewrite not working for certain extensions and characters
I am using IIS 7.5 with the Url Rewrite module. Here is my rule. ... Everything works as expected, except if the url...
Read more >
URL Rewrite Module Configuration Reference - Microsoft Learn
If a rewrite rule set uses any server variable not mentioned in the above list, the rule set is considered unsafe for output...
Read more >
Introduction To URL Rewriting - Smashing Magazine
With URL rewriting, the URL and the resource that it leads to can be completely independent of each other. In practice, they're usually...
Read more >
Force your site to load securely with an .htaccess file
Overview After you have added an SSL certificate to your domain, DreamHost automatically redirects the URL visitors use to view your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found