Search code examples
aws-lambda

Special characters in Function URL


I am using a lambda function URL that looks something like this...

https://xxx.lambda-url.us-east-1.on.aws/?test this

This is working as expected (actually awesome!)

But it fails if the user types / or , and it does not submit the text after #

I can replace these three characters with space and the problem is solved. But are there any other characters I need to take care of?

(app developed using kotlin if that matters)


Solution

  • Yes you need to 'percent encode it' or 'url encode it'. If you're generating the URL in javascript you can use the URL object or encodeURIComponent().

    As a general rule in programming, whenever you generate a string that has some kind of format, you should always ask: "What is the escaping mechanism". Failing to do so can result in bugs and big security problems.